diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 0d4ddf8e553e..8054bf818a11 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -163,9 +163,9 @@ void cpu_add(u_int apic_id, char boot_cpu) { - if (apic_id > MAXCPU) { + if (apic_id >= MAXCPU) { printf("SMP: CPU %d exceeds maximum CPU %d, ignoring\n", - apic_id, MAXCPU); + apic_id, MAXCPU - 1); return; } KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %d added twice", diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c index f0a988347c56..a65ca0f58395 100644 --- a/sys/amd64/amd64/mptable.c +++ b/sys/amd64/amd64/mptable.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); /* string defined by the Intel MP Spec as identifying the MP table */ #define MP_SIG 0x5f504d5f /* _MP_ */ -#define NAPICID 32 /* Max number of I/O APIC's */ +#define NAPICID 32 /* Max number of APIC's */ #define BIOS_BASE (0xf0000) #define BIOS_SIZE (0x10000) @@ -811,7 +811,7 @@ mptable_hyperthread_fixup(u_int id_mask) * physical processor. If any of those ID's are * already in the table, then kill the fixup. */ - for (id = 0; id <= MAXCPU; id++) { + for (id = 0; id < NAPICID; id++) { if ((id_mask & 1 << id) == 0) continue; /* First, make sure we are on a logical_cpus boundary. */