summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/main.c b/main.c
index 0f1acc8..464112b 100644
--- a/main.c
+++ b/main.c
@@ -42,14 +42,12 @@ main(void)
userinit(); // first user process
// Allocate scheduler stacks and boot the other CPUs.
- for(i=0; i<ncpu; i++){
+ for(i=0; i<ncpu; i++)
cpus[i].stack = kalloc(KSTACKSIZE);
- *(void**)(cpus[i].stack + KSTACKTOP) = 0;
- }
bootothers();
// Switch to our scheduler stack and continue with mpmain.
- asm volatile("movl %0, %%esp" : : "r" (cpus[bcpu].stack+KSTACKTOP));
+ asm volatile("movl %0, %%esp" : : "r" (cpus[bcpu].stack+KSTACKSIZE));
mpmain();
}
@@ -86,7 +84,7 @@ bootothers(void)
continue;
// Fill in %esp, %eip and start code on cpu.
- *(void**)(code-4) = c->stack + KSTACKTOP;
+ *(void**)(code-4) = c->stack + KSTACKSIZE;
*(void**)(code-8) = mpmain;
lapic_startap(c->apicid, (uint)code);