]> Devi Nivas Git - cs3210-lab0.git/commitdiff
remove acquire1 and release1
authorrsc <rsc>
Sun, 16 Jul 2006 15:38:13 +0000 (15:38 +0000)
committerrsc <rsc>
Sun, 16 Jul 2006 15:38:13 +0000 (15:38 +0000)
defs.h
spinlock.c

diff --git a/defs.h b/defs.h
index 0288a6264bd8b5999380acbe811d3e945f6585ba..cb129a48251f5e278c0d7d4a79dc885771853510 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -64,8 +64,6 @@ int cpu(void);
 struct spinlock;
 void acquire(struct spinlock * lock);
 void release(struct spinlock * lock);
-void acquire1(struct spinlock * lock, struct proc *);
-void release1(struct spinlock * lock, struct proc *);
 
 // main.c
 void load_icode(struct proc *p, uint8_t *binary, unsigned size);
index aa11ad51bed00ab011a19888910063752337c96f..7ab0bbeb41cca23f268e882aa0b0d9614013352c 100644 (file)
@@ -10,7 +10,7 @@
 // because cprintf uses them itself.
 #define cprintf dont_use_cprintf
 
-extern int use_console_lock;
+extern int bootstrap;
 
 int
 getcallerpc(void *v)
@@ -19,7 +19,7 @@ getcallerpc(void *v)
 }
 
 void
-acquire1(struct spinlock * lock, struct proc *cp)
+acquire(struct spinlock * lock)
 {
        if(cpus[cpu()].nlock++ == 0)
                cli();
@@ -30,23 +30,11 @@ acquire1(struct spinlock * lock, struct proc *cp)
 }
 
 void
-release1(struct spinlock * lock, struct proc *cp)
+release(struct spinlock * lock)
 {
        cpuid(0, 0, 0, 0, 0);   // memory barrier
        lock->locked = 0;
-       if(--cpus[cpu()].nlock == 0)
+       if(--cpus[cpu()].nlock == 0 && !bootstrap)
                sti();
 }
 
-void
-acquire(struct spinlock *lock)
-{
-       acquire1(lock, curproc[cpu()]);
-}
-
-void
-release(struct spinlock *lock)
-{
-       release1(lock, curproc[cpu()]);
-}
-