tweak
This commit is contained in:
parent
902b13f5d6
commit
124f32ae38
1 changed files with 3 additions and 7 deletions
10
main.c
10
main.c
|
@ -20,7 +20,7 @@ void
|
||||||
main0(void)
|
main0(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static int bcpu; // cannot be on stack
|
static volatile int bcpu; // cannot be on stack
|
||||||
|
|
||||||
// clear BSS
|
// clear BSS
|
||||||
memset(edata, 0, end - edata);
|
memset(edata, 0, end - edata);
|
||||||
|
@ -32,7 +32,7 @@ main0(void)
|
||||||
mp_init(); // collect info about this machine
|
mp_init(); // collect info about this machine
|
||||||
bcpu = mp_bcpu();
|
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, %%esp" : : "r" (cpus[bcpu].mpstack+MPSTACK-32));
|
||||||
asm volatile("movl %0, %%ebp" : : "r" (cpus[bcpu].mpstack+MPSTACK));
|
asm volatile("movl %0, %%ebp" : : "r" (cpus[bcpu].mpstack+MPSTACK));
|
||||||
|
|
||||||
|
@ -72,14 +72,10 @@ void
|
||||||
mpmain(void)
|
mpmain(void)
|
||||||
{
|
{
|
||||||
cprintf("cpu%d: starting\n", cpu());
|
cprintf("cpu%d: starting\n", cpu());
|
||||||
idtinit(); // CPU's idt
|
idtinit();
|
||||||
if(cpu() == 0)
|
|
||||||
panic("mpmain on cpu 0");
|
|
||||||
lapic_init(cpu());
|
lapic_init(cpu());
|
||||||
lapic_timerinit();
|
lapic_timerinit();
|
||||||
lapic_enableintr();
|
lapic_enableintr();
|
||||||
|
|
||||||
// make sure there's a TSS
|
|
||||||
setupsegs(0);
|
setupsegs(0);
|
||||||
|
|
||||||
cpuid(0, 0, 0, 0, 0); // memory barrier
|
cpuid(0, 0, 0, 0, 0); // memory barrier
|
||||||
|
|
Loading…
Reference in a new issue