Nasty unfixed bug related to spinlock panics
This commit is contained in:
parent
d9896b4229
commit
bccc0b5200
1 changed files with 11 additions and 1 deletions
|
@ -4,10 +4,12 @@
|
|||
*/
|
||||
|
||||
// #include <lib/stdio.h>
|
||||
#include "string.h"
|
||||
#include <panic.h>
|
||||
#include <proc.h>
|
||||
#include <riscv.h>
|
||||
#include <spinlock.h>
|
||||
#include <uart.h>
|
||||
|
||||
/**
|
||||
* The aquire() and release() functions control ownership of the lock.
|
||||
|
@ -99,6 +101,7 @@ void push_off(void) {
|
|||
intr_off();
|
||||
if (mycpu()->noff == 0)
|
||||
mycpu()->intena = old;
|
||||
|
||||
mycpu()->noff += 1;
|
||||
}
|
||||
|
||||
|
@ -106,8 +109,15 @@ void pop_off(void) {
|
|||
struct Cpu *c = mycpu();
|
||||
if (intr_get())
|
||||
panic("pop_off - interruptible");
|
||||
if (c->noff < 1)
|
||||
if (c->noff < 1) {
|
||||
{
|
||||
// TODO: Remove this block when fixed
|
||||
char amt[100];
|
||||
itoa(c->noff, amt, 10);
|
||||
uart_puts(amt);
|
||||
}
|
||||
panic("pop_off");
|
||||
}
|
||||
c->noff -= 1;
|
||||
if (c->noff == 0 && c->intena)
|
||||
intr_on();
|
||||
|
|
Loading…
Add table
Reference in a new issue