This commit is contained in:
rsc 2007-08-24 19:36:52 +00:00
parent 902b13f5d6
commit 124f32ae38

10
main.c
View file

@ -20,7 +20,7 @@ void
main0(void)
{
int i;
static int bcpu; // cannot be on stack
static volatile int bcpu; // cannot be on stack
// clear BSS
memset(edata, 0, end - edata);
@ -32,7 +32,7 @@ main0(void)
mp_init(); // collect info about this machine
bcpu = mp_bcpu();
// switch to bootstrap processor's stack
// Switch to bootstrap processor's stack
asm volatile("movl %0, %%esp" : : "r" (cpus[bcpu].mpstack+MPSTACK-32));
asm volatile("movl %0, %%ebp" : : "r" (cpus[bcpu].mpstack+MPSTACK));
@ -72,14 +72,10 @@ void
mpmain(void)
{
cprintf("cpu%d: starting\n", cpu());
idtinit(); // CPU's idt
if(cpu() == 0)
panic("mpmain on cpu 0");
idtinit();
lapic_init(cpu());
lapic_timerinit();
lapic_enableintr();
// make sure there's a TSS
setupsegs(0);
cpuid(0, 0, 0, 0, 0); // memory barrier