diff options
-rw-r--r-- | sys/arch/amd64/amd64/cpu.c | 17 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/db_interface.c | 59 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/genassym.cf | 3 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/lapic.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mptramp.S | 12 | ||||
-rw-r--r-- | sys/arch/i386/i386/cpu.c | 17 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_interface.c | 58 | ||||
-rw-r--r-- | sys/arch/i386/i386/genassym.cf | 3 | ||||
-rw-r--r-- | sys/arch/i386/i386/ipifuncs.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/kvm86call.S | 43 | ||||
-rw-r--r-- | sys/arch/i386/i386/lapic.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/mptramp.s | 14 |
12 files changed, 108 insertions, 132 deletions
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index aa84155b939..75a1ffaba82 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.28 2009/06/09 02:56:38 krw Exp $ */ +/* $OpenBSD: cpu.c,v 1.29 2010/04/01 19:47:59 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -158,13 +158,6 @@ static void cpu_copy_trampoline(void); void cpu_init_first(void) { - int cpunum = lapic_cpu_number(); - - if (cpunum != 0) { - cpu_info[0] = NULL; - cpu_info[cpunum] = &cpu_info_primary; - } - cpu_copy_trampoline(); } #endif @@ -225,7 +218,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux) struct cpu_attach_args *caa = aux; struct cpu_info *ci; #if defined(MULTIPROCESSOR) - int cpunum = caa->cpu_number; + int cpunum = sc->sc_dev.dv_unit; vaddr_t kstack; struct pcb *pcb; #endif @@ -248,10 +241,10 @@ cpu_attach(struct device *parent, struct device *self, void *aux) } else { ci = &cpu_info_primary; #if defined(MULTIPROCESSOR) - if (cpunum != lapic_cpu_number()) { + if (caa->cpu_number != lapic_cpu_number()) { panic("%s: running cpu is at apic %d" " instead of at expected %d", - sc->sc_dev.dv_xname, lapic_cpu_number(), cpunum); + sc->sc_dev.dv_xname, lapic_cpu_number(), caa->cpu_number); } #endif } @@ -262,7 +255,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux) ci->ci_dev = self; ci->ci_apicid = caa->cpu_number; #ifdef MULTIPROCESSOR - ci->ci_cpuid = ci->ci_apicid; + ci->ci_cpuid = cpunum; #else ci->ci_cpuid = 0; /* False for APs, but they're not used anyway */ #endif diff --git a/sys/arch/amd64/amd64/db_interface.c b/sys/arch/amd64/amd64/db_interface.c index 36455c96a3b..a6d95bc986d 100644 --- a/sys/arch/amd64/amd64/db_interface.c +++ b/sys/arch/amd64/amd64/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.15 2008/10/03 21:57:25 weingart Exp $ */ +/* $OpenBSD: db_interface.c,v 1.16 2010/04/01 19:47:59 kettenis Exp $ */ /* $NetBSD: db_interface.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /* @@ -83,7 +83,6 @@ void db_cpuinfo_cmd(db_expr_t, int, db_expr_t, char *); void db_startproc_cmd(db_expr_t, int, db_expr_t, char *); void db_stopproc_cmd(db_expr_t, int, db_expr_t, char *); void db_ddbproc_cmd(db_expr_t, int, db_expr_t, char *); -int db_cpuid2apic(int); #endif /* @@ -162,19 +161,6 @@ kdb_trap(int type, int code, db_regs_t *regs) #ifdef MULTIPROCESSOR -int -db_cpuid2apic(int id) -{ - int apic; - - for (apic = 0; apic < MAXCPUS; apic++) { - if (cpu_info[apic] != NULL && - CPU_INFO_UNIT(cpu_info[apic]) == id) - return (apic); - } - return (-1); -} - void db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { @@ -212,20 +198,18 @@ db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_startproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { - int apic; + int i; if (have_addr) { - apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < MAXCPUS && - cpu_info[apic] != NULL && apic != cpu_number()) - db_startcpu(apic); + if (addr >= 0 && addr < MAXCPUS && + cpu_info[addr] != NULL && addr != cpu_number()) + db_startcpu(addr); else db_printf("Invalid cpu %d\n", (int)addr); } else { - for (apic = 0; apic < MAXCPUS; apic++) { - if (cpu_info[apic] != NULL && apic != cpu_number()) { - db_startcpu(apic); - } + for (i = 0; i < MAXCPUS; i++) { + if (cpu_info[i] != NULL && i != cpu_number()) + db_startcpu(i); } } } @@ -233,20 +217,18 @@ db_startproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_stopproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { - int apic; + int i; if (have_addr) { - apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < MAXCPUS && - cpu_info[apic] != NULL && apic != cpu_number()) - db_stopcpu(apic); + if (addr >= 0 && addr < MAXCPUS && + cpu_info[addr] != NULL && addr != cpu_number()) + db_stopcpu(addr); else db_printf("Invalid cpu %d\n", (int)addr); } else { - for (apic = 0; apic < MAXCPUS; apic++) { - if (cpu_info[apic] != NULL && apic != cpu_number()) { - db_stopcpu(apic); - } + for (i = 0; i < MAXCPUS; i++) { + if (cpu_info[i] != NULL && i != cpu_number()) + db_stopcpu(i); } } } @@ -254,14 +236,11 @@ db_stopproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_ddbproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { - int apic; - if (have_addr) { - apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < MAXCPUS && - cpu_info[apic] != NULL && apic != cpu_number()) { - db_stopcpu(apic); - db_switch_to_cpu = apic; + if (addr >= 0 && addr < MAXCPUS && + cpu_info[addr] != NULL && addr != cpu_number()) { + db_stopcpu(addr); + db_switch_to_cpu = addr; db_switch_cpu = 1; db_cmd_loop_done = 1; } else { diff --git a/sys/arch/amd64/amd64/genassym.cf b/sys/arch/amd64/amd64/genassym.cf index 381b7d0438c..602221a923f 100644 --- a/sys/arch/amd64/amd64/genassym.cf +++ b/sys/arch/amd64/amd64/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.21 2009/06/09 02:56:38 krw Exp $ +# $OpenBSD: genassym.cf,v 1.22 2010/04/01 19:47:59 kettenis Exp $ # Written by Artur Grabowski art@openbsd.org, Public Domain include <sys/param.h> @@ -94,6 +94,7 @@ member pcb_fpcpu struct cpu_info member CPU_INFO_SCRATCH ci_scratch member CPU_INFO_SELF ci_self +member CPU_INFO_APICID ci_apicid member CPU_INFO_RESCHED ci_want_resched member CPU_INFO_CURPROC ci_curproc member CPU_INFO_CURPCB ci_curpcb diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c index c1fab756130..2dbd9acb983 100644 --- a/sys/arch/amd64/amd64/lapic.c +++ b/sys/arch/amd64/amd64/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.22 2009/08/10 17:04:37 deraadt Exp $ */ +/* $OpenBSD: lapic.c,v 1.23 2010/04/01 19:47:59 kettenis Exp $ */ /* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */ /*- @@ -113,7 +113,7 @@ lapic_map(paddr_t lapic_base) invlpg(va); #ifdef MULTIPROCESSOR - cpu_init_first(); /* catch up to changed cpu_number() */ + cpu_init_first(); #endif lapic_tpr = s; diff --git a/sys/arch/amd64/amd64/mptramp.S b/sys/arch/amd64/amd64/mptramp.S index 72b17773951..98d9f861f2d 100644 --- a/sys/arch/amd64/amd64/mptramp.S +++ b/sys/arch/amd64/amd64/mptramp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: mptramp.S,v 1.5 2008/06/26 05:42:09 ray Exp $ */ +/* $OpenBSD: mptramp.S,v 1.6 2010/04/01 19:47:59 kettenis Exp $ */ /* $NetBSD: mptramp.S,v 1.1 2003/04/26 18:39:30 fvdl Exp $ */ /*- @@ -208,9 +208,15 @@ _TRMP_LABEL(mptramp_longmode) _C_LABEL(cpu_spinup_trampoline_end): #end of code copied to MP_TRAMPOLINE - movl _C_LABEL(local_apic)+LAPIC_ID,%ecx - shrl $LAPIC_ID_SHIFT,%ecx + movl _C_LABEL(local_apic)+LAPIC_ID,%eax + shrl $LAPIC_ID_SHIFT,%eax + xorq %rcx,%rcx +1: movq _C_LABEL(cpu_info)(,%rcx,8),%rdi + incq %rcx + movl CPU_INFO_APICID(%rdi),%edx + cmpl %eax,%edx + jne 1b movq CPU_INFO_IDLE_PCB(%rdi),%rsi diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index b586ab0cc42..36b1f217f6d 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.35 2009/06/03 00:49:12 art Exp $ */ +/* $OpenBSD: cpu.c,v 1.36 2010/04/01 19:48:50 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -144,13 +144,6 @@ void cpu_copy_trampoline(void); void cpu_init_first() { - int cpunum = lapic_cpu_number(); - - if (cpunum != 0) { - cpu_info[0] = NULL; - cpu_info[cpunum] = &cpu_info_primary; - } - cpu_copy_trampoline(); } #endif @@ -181,7 +174,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux) struct cpu_attach_args *caa = (struct cpu_attach_args *)aux; #ifdef MULTIPROCESSOR - int cpunum = caa->cpu_number; + int cpunum = ci->ci_dev.dv_unit; vaddr_t kstack; struct pcb *pcb; #endif @@ -195,10 +188,10 @@ cpu_attach(struct device *parent, struct device *self, void *aux) } else { ci = &cpu_info_primary; #ifdef MULTIPROCESSOR - if (cpunum != lapic_cpu_number()) { + if (caa->cpu_number != lapic_cpu_number()) { panic("%s: running cpu is at apic %d" " instead of at expected %d", - self->dv_xname, lapic_cpu_number(), cpunum); + self->dv_xname, lapic_cpu_number(), caa->cpu_number); } #endif bcopy(self, &ci->ci_dev, sizeof *self); @@ -207,7 +200,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux) ci->ci_self = ci; ci->ci_apicid = caa->cpu_number; #ifdef MULTIPROCESSOR - ci->ci_cpuid = ci->ci_apicid; + ci->ci_cpuid = cpunum; #else ci->ci_cpuid = 0; /* False for APs, so what, they're not used */ #endif diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index f0d01c29d96..5d5590f42d6 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.25 2007/11/16 16:16:06 deraadt Exp $ */ +/* $OpenBSD: db_interface.c,v 1.26 2010/04/01 19:48:50 kettenis Exp $ */ /* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */ /* @@ -77,7 +77,6 @@ void db_cpuinfo_cmd(db_expr_t, int, db_expr_t, char *); void db_startproc_cmd(db_expr_t, int, db_expr_t, char *); void db_stopproc_cmd(db_expr_t, int, db_expr_t, char *); void db_ddbproc_cmd(db_expr_t, int, db_expr_t, char *); -int db_cpuid2apic(int); #endif /* MULTIPROCESSOR */ /* @@ -210,19 +209,6 @@ db_sysregs_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) } #ifdef MULTIPROCESSOR -int -db_cpuid2apic(int id) -{ - int apic; - - for (apic = 0; apic < MAXCPUS; apic++) { - if (cpu_info[apic] != NULL && - cpu_info[apic]->ci_dev.dv_unit == id) - return (apic); - } - return (-1); -} - void db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { @@ -260,20 +246,18 @@ db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_startproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { - int apic; + int i; if (have_addr) { - apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < MAXCPUS && - cpu_info[apic] != NULL && apic != cpu_number()) - db_startcpu(apic); + if (addr >= 0 && addr < MAXCPUS && + cpu_info[addr] != NULL && addr != cpu_number()) + db_startcpu(addr); else db_printf("Invalid cpu %d\n", (int)addr); } else { - for (apic = 0; apic < MAXCPUS; apic++) { - if (cpu_info[apic] != NULL && apic != cpu_number()) { - db_startcpu(apic); - } + for (i = 0; i < MAXCPUS; i++) { + if (cpu_info[i] != NULL && i != cpu_number()) + db_startcpu(i); } } } @@ -281,19 +265,18 @@ db_startproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_stopproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { - int apic; + int i; if (have_addr) { - apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < MAXCPUS && - cpu_info[apic] != NULL && apic != cpu_number()) - db_stopcpu(apic); + if (addr >= 0 && addr < MAXCPUS && + cpu_info[addr] != NULL && addr != cpu_number()) + db_stopcpu(addr); else db_printf("Invalid cpu %d\n", (int)addr); } else { - for (apic = 0; apic < MAXCPUS; apic++) { - if (cpu_info[apic] != NULL && apic != cpu_number()) { - db_stopcpu(apic); + for (i = 0; i < MAXCPUS; i++) { + if (cpu_info[i] != NULL && i != cpu_number()) { + db_stopcpu(i); } } } @@ -302,14 +285,11 @@ db_stopproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_ddbproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { - int apic; - if (have_addr) { - apic = db_cpuid2apic(addr); - if (apic >= 0 && apic < MAXCPUS && - cpu_info[apic] != NULL && apic != cpu_number()) { - db_stopcpu(apic); - db_switch_to_cpu = apic; + if (addr >= 0 && addr < MAXCPUS && + cpu_info[addr] != NULL && addr != cpu_number()) { + db_stopcpu(addr); + db_switch_to_cpu = addr; db_switch_cpu = 1; db_cmd_loop_done = 1; } else { diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf index 6506af35feb..678ce236452 100644 --- a/sys/arch/i386/i386/genassym.cf +++ b/sys/arch/i386/i386/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.29 2009/06/03 00:49:12 art Exp $ +# $OpenBSD: genassym.cf,v 1.30 2010/04/01 19:48:50 kettenis Exp $ # # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -191,6 +191,7 @@ define IP_DST offsetof(struct ip, ip_dst) define P_MD_TSS_SEL offsetof(struct proc, p_md.md_tss_sel) define CPU_INFO_SELF offsetof(struct cpu_info, ci_self) +define CPU_INFO_APICID offsetof(struct cpu_info, ci_apicid) define CPU_INFO_CURPROC offsetof(struct cpu_info, ci_curproc) define CPU_INFO_CURPCB offsetof(struct cpu_info, ci_curpcb) define CPU_INFO_NAME offsetof(struct cpu_info, ci_dev.dv_xname) diff --git a/sys/arch/i386/i386/ipifuncs.c b/sys/arch/i386/i386/ipifuncs.c index aeba0d7df00..f0facf0b339 100644 --- a/sys/arch/i386/i386/ipifuncs.c +++ b/sys/arch/i386/i386/ipifuncs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipifuncs.c,v 1.14 2009/11/29 17:11:30 kettenis Exp $ */ +/* $OpenBSD: ipifuncs.c,v 1.15 2010/04/01 19:48:50 kettenis Exp $ */ /* $NetBSD: ipifuncs.c,v 1.1.2.3 2000/06/26 02:04:06 sommerfeld Exp $ */ /*- @@ -148,7 +148,7 @@ i386_send_ipi(struct cpu_info *ci, int ipimask) if (!(ci->ci_flags & CPUF_RUNNING)) return ENOENT; - ret = i386_ipi(LAPIC_IPI_VECTOR, ci->ci_cpuid, LAPIC_DLMODE_FIXED); + ret = i386_ipi(LAPIC_IPI_VECTOR, ci->ci_apicid, LAPIC_DLMODE_FIXED); if (ret != 0) { printf("ipi of %x from %s to %s failed\n", ipimask, curcpu()->ci_dev.dv_xname, ci->ci_dev.dv_xname); @@ -163,7 +163,7 @@ i386_fast_ipi(struct cpu_info *ci, int ipi) if (!(ci->ci_flags & CPUF_RUNNING)) return (ENOENT); - return (i386_ipi(ipi, ci->ci_cpuid, LAPIC_DLMODE_FIXED)); + return (i386_ipi(ipi, ci->ci_apicid, LAPIC_DLMODE_FIXED)); } void diff --git a/sys/arch/i386/i386/kvm86call.S b/sys/arch/i386/i386/kvm86call.S index de48f15ef8a..276a149a32e 100644 --- a/sys/arch/i386/i386/kvm86call.S +++ b/sys/arch/i386/i386/kvm86call.S @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm86call.S,v 1.4 2006/12/11 23:45:13 gwk Exp $ */ +/* $OpenBSD: kvm86call.S,v 1.5 2010/04/01 19:48:50 kettenis Exp $ */ /* $NetBSD: kvm86call.S,v 1.7 2006/04/11 17:14:07 drochner Exp $ */ /*- @@ -78,12 +78,17 @@ ENTRY(kvm86_call) rep movsl /* copy frame to new stack */ -#ifdef MULTIPROCESSOR - movl _C_LABEL(local_apic)+LAPIC_ID,%ecx - shrl $LAPIC_ID_SHIFT,%ecx - leal 0(,%ecx,4),%ecx - movl _C_LABEL(cpu_info)(%ecx),%edx - movl %edx,%ecx +#ifdef MULTIPROCESSOR + movl _C_LABEL(local_apic)+LAPIC_ID,%eax + shrl $LAPIC_ID_SHIFT,%eax + xorl %ebx,%ebx +1: + leal 0(,%ebx,4),%ecx + incl %ebx + movl _C_LABEL(cpu_info)(%ecx),%ecx + movl CPU_INFO_APICID(%ecx),%edx + cmpl %eax,%edx + jne 1b #else leal _C_LABEL(cpu_info_primary),%ecx #endif @@ -172,10 +177,16 @@ ENTRY(kvm86_ret) #ifdef MULTIPROCESSOR - movl _C_LABEL(local_apic)+LAPIC_ID,%ecx - shrl $LAPIC_ID_SHIFT,%ecx - leal 0(,%ecx,4),%ecx + movl _C_LABEL(local_apic)+LAPIC_ID,%eax + shrl $LAPIC_ID_SHIFT,%eax + xorl %ebx,%ebx +1: + leal 0(,%ebx,4),%ecx + incl %ebx movl _C_LABEL(cpu_info)(%ecx),%ecx + movl CPU_INFO_APICID(%ecx),%edx + cmpl %eax,%edx + jne 1b movl CPU_INFO_GDT(%ecx),%eax #else leal _C_LABEL(cpu_info_primary),%ecx @@ -191,10 +202,16 @@ ENTRY(kvm86_ret) #ifdef MULTIPROCESSOR - movl _C_LABEL(local_apic)+LAPIC_ID,%ecx - shrl $LAPIC_ID_SHIFT,%ecx - leal 0(,%ecx,4),%ecx + movl _C_LABEL(local_apic)+LAPIC_ID,%eax + shrl $LAPIC_ID_SHIFT,%eax + xorl %ebx,%ebx +1: + leal 0(,%ebx,4),%ecx + incl %ebx movl _C_LABEL(cpu_info)(%ecx),%ecx + movl CPU_INFO_APICID(%ecx),%edx + cmpl %eax,%edx + jne 1b #else leal _C_LABEL(cpu_info_primary),%ecx #endif diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c index 77f682212ea..11760a497d0 100644 --- a/sys/arch/i386/i386/lapic.c +++ b/sys/arch/i386/i386/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.26 2009/08/10 17:04:39 deraadt Exp $ */ +/* $OpenBSD: lapic.c,v 1.27 2010/04/01 19:48:50 kettenis Exp $ */ /* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */ /*- @@ -90,7 +90,7 @@ lapic_map(paddr_t lapic_base) invlpg(va); #ifdef MULTIPROCESSOR - cpu_init_first(); /* catch up to changed cpu_number() */ + cpu_init_first(); #endif lapic_tpr = s; diff --git a/sys/arch/i386/i386/mptramp.s b/sys/arch/i386/i386/mptramp.s index 499a36dd722..e7d521e52e5 100644 --- a/sys/arch/i386/i386/mptramp.s +++ b/sys/arch/i386/i386/mptramp.s @@ -1,4 +1,4 @@ -/* $OpenBSD: mptramp.s,v 1.12 2009/07/10 13:51:47 jsg Exp $ */ +/* $OpenBSD: mptramp.s,v 1.13 2010/04/01 19:48:50 kettenis Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -171,10 +171,16 @@ _TRMP_LABEL(mp_startup) # ok, we're now running with paging enabled and sharing page tables with cpu0. # figure out which processor we really are, what stack we should be on, etc. - movl _C_LABEL(local_apic)+LAPIC_ID,%ecx - shrl $LAPIC_ID_SHIFT,%ecx - leal 0(,%ecx,4),%ecx + movl _C_LABEL(local_apic)+LAPIC_ID,%eax + shrl $LAPIC_ID_SHIFT,%eax + xorl %ebx,%ebx +1: + leal 0(,%ebx,4),%ecx + incl %ebx movl _C_LABEL(cpu_info)(%ecx),%ecx + movl CPU_INFO_APICID(%ecx),%edx + cmpl %eax,%edx + jne 1b HALTT(0x7, %ecx) |