From bf342084e52eba82974d7a74daff205ae6e23b66 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Thu, 11 Dec 2003 02:47:35 +0000 Subject: [PATCH] MFi386: (jhb): Deal with MAXCPU etc correctly --- sys/amd64/amd64/mp_machdep.c | 4 ++-- sys/amd64/amd64/mptable.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 0d4ddf8e553..8054bf818a1 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 f0a988347c5..a65ca0f5839 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. */ -- 2.45.2