nits
This commit is contained in:
parent
f2ab0eb644
commit
d9160fb4b9
6 changed files with 12 additions and 10 deletions
|
@ -261,7 +261,6 @@ r_time()
|
|||
static inline void
|
||||
intr_on()
|
||||
{
|
||||
w_sie(r_sie() | SIE_SEIE | SIE_STIE | SIE_SSIE);
|
||||
w_sstatus(r_sstatus() | SSTATUS_SIE);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,13 +72,12 @@ release(struct spinlock *lk)
|
|||
}
|
||||
|
||||
// Check whether this cpu is holding the lock.
|
||||
// Interrupts must be off.
|
||||
int
|
||||
holding(struct spinlock *lk)
|
||||
{
|
||||
int r;
|
||||
push_off();
|
||||
r = (lk->locked && lk->cpu == mycpu());
|
||||
pop_off();
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -103,9 +102,9 @@ pop_off(void)
|
|||
struct cpu *c = mycpu();
|
||||
if(intr_get())
|
||||
panic("pop_off - interruptible");
|
||||
c->noff -= 1;
|
||||
if(c->noff < 0)
|
||||
if(c->noff < 1)
|
||||
panic("pop_off");
|
||||
c->noff -= 1;
|
||||
if(c->noff == 0 && c->intena)
|
||||
intr_on();
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ start()
|
|||
// delegate all interrupts and exceptions to supervisor mode.
|
||||
w_medeleg(0xffff);
|
||||
w_mideleg(0xffff);
|
||||
w_sie(r_sie() | SIE_SEIE | SIE_STIE | SIE_SSIE);
|
||||
|
||||
// ask for clock interrupts.
|
||||
timerinit();
|
||||
|
|
|
@ -129,7 +129,6 @@ usertrapret(void)
|
|||
|
||||
// interrupts and exceptions from kernel code go here via kernelvec,
|
||||
// on whatever the current kernel stack is.
|
||||
// must be 4-byte aligned to fit in stvec.
|
||||
void
|
||||
kerneltrap()
|
||||
{
|
||||
|
@ -189,9 +188,13 @@ devintr()
|
|||
uartintr();
|
||||
} else if(irq == VIRTIO0_IRQ){
|
||||
virtio_disk_intr();
|
||||
} else if(irq){
|
||||
printf("unexpected interrupt irq=%d\n", irq);
|
||||
}
|
||||
|
||||
plic_complete(irq);
|
||||
if(irq)
|
||||
plic_complete(irq);
|
||||
|
||||
return 1;
|
||||
} else if(scause == 0x8000000000000001L){
|
||||
// software interrupt from a machine-mode timer interrupt,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue