]> Devi Nivas Git - cs3210-lab0.git/commitdiff
more bugs
authorrsc <rsc>
Wed, 8 Aug 2007 09:10:16 +0000 (09:10 +0000)
committerrsc <rsc>
Wed, 8 Aug 2007 09:10:16 +0000 (09:10 +0000)
BUGS
main.c

diff --git a/BUGS b/BUGS
index 509b41499699014d23236d82a6000a2fc32dafc3..167f5c52faf8db4c6ab20c49c7f1f36219915ab4 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -4,13 +4,6 @@ index:
 mmu.h:
        funny \ alignment in mmu.h
 
-main.c:
-       should use static int bcpu to avoid having live
-       stack variable across the asm volatile that 
-       changes %esp and %ebp.
-
-       cpus[0] -> cpus[bcpu]
-
 proc.c:
        as a consequence of the implementation of proc_kill,
        any loop calling sleep should check for p->killed
diff --git a/main.c b/main.c
index ad0c9c238ef0a46f9fb99228ca91d735a4291a6b..0d2a0171b4bd390a988de50dfaffc2df2179c385 100644 (file)
--- a/main.c
+++ b/main.c
@@ -23,7 +23,7 @@ void
 main0(void)
 {
   int i;
-  int bcpu;
+  static int bcpu;  // cannot be on stack
   struct proc *p;
 
   // clear BSS
@@ -37,8 +37,8 @@ main0(void)
   bcpu = mp_bcpu();
 
   // switch to bootstrap processor's stack
-  asm volatile("movl %0, %%esp" : : "r" (cpus[0].mpstack + MPSTACK - 32));
-  asm volatile("movl %0, %%ebp" : : "r" (cpus[0].mpstack + MPSTACK));
+  asm volatile("movl %0, %%esp" : : "r" (cpus[bcpu].mpstack + MPSTACK - 32));
+  asm volatile("movl %0, %%ebp" : : "r" (cpus[bcpu].mpstack + MPSTACK));
 
   lapic_init(bcpu);