diff options
Diffstat (limited to 'kernel/spinlock.c')
-rw-r--r-- | kernel/spinlock.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/spinlock.c b/kernel/spinlock.c index 5a44a46..1d0b16a 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c @@ -47,9 +47,16 @@ acquire(struct spinlock *lk) void release(struct spinlock *lk) { - if(!holding(lk)) + uint64 x; + asm volatile("mv %0, ra" : "=r" (x) ); + if(!holding(lk)) { + printf("%p: !holding %d %s %p %p %p %p\n", mycpu(), lk->locked, lk->name, lk->cpu, + lk->last_release, lk->last_pc, x); panic("release"); + } + lk->last_release = lk->cpu; + lk->last_pc = x; lk->cpu = 0; // Tell the C compiler and the CPU to not move loads or stores |