diff options
author | rtm <rtm> | 2006-07-29 09:35:02 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-07-29 09:35:02 +0000 |
commit | 32630628a996e29018641af262272339ed6fef88 (patch) | |
tree | 73c9a7dee75f96c0ce0e9c804d379dd60bf254b4 /spinlock.c | |
parent | e46fb46fcf4302bf5ed913101c5c7b510fe03ad4 (diff) | |
download | xv6-labs-32630628a996e29018641af262272339ed6fef88.tar.gz xv6-labs-32630628a996e29018641af262272339ed6fef88.tar.bz2 xv6-labs-32630628a996e29018641af262272339ed6fef88.zip |
open()
Diffstat (limited to 'spinlock.c')
-rw-r--r-- | spinlock.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -8,7 +8,7 @@ // Can't call cprintf from inside these routines, // because cprintf uses them itself. -#define cprintf dont_use_cprintf +//#define cprintf dont_use_cprintf extern int use_console_lock; @@ -21,8 +21,12 @@ getcallerpc(void *v) void acquire(struct spinlock * lock) { - if(holding(lock)) + if(holding(lock)){ + extern use_console_lock; + use_console_lock = 0; + cprintf("lock %s pc %x\n", lock->name ? lock->name : "", lock->pc); panic("acquire"); + } if(cpus[cpu()].nlock++ == 0) cli(); @@ -31,6 +35,7 @@ acquire(struct spinlock * lock) cpuid(0, 0, 0, 0, 0); // memory barrier lock->pc = getcallerpc(&lock); lock->cpu = cpu(); + cpus[cpu()].lastacquire = lock; } void @@ -39,6 +44,7 @@ release(struct spinlock * lock) if(!holding(lock)) panic("release"); + cpus[cpu()].lastrelease = lock; cpuid(0, 0, 0, 0, 0); // memory barrier lock->locked = 0; if(--cpus[cpu()].nlock == 0) |