This commit is contained in:
Robert Morris 2019-10-27 08:03:19 -04:00
parent f2ab0eb644
commit d9160fb4b9
6 changed files with 12 additions and 10 deletions

View file

@ -104,7 +104,7 @@ $U/_forktest: $U/forktest.o $(ULIB)
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $U/_forktest $U/forktest.o $U/ulib.o $U/usys.o
$(OBJDUMP) -S $U/_forktest > $U/forktest.asm
mkfs/mkfs: mkfs/mkfs.c $K/fs.h
mkfs/mkfs: mkfs/mkfs.c $K/fs.h $K/param.h
gcc -Werror -Wall -I. -o mkfs/mkfs mkfs/mkfs.c
# Prevent deletion of intermediate files, e.g. cat.o, after first build, so

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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();

View file

@ -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,

View file

@ -2105,9 +2105,9 @@ run(void f(char *), char *s) {
} else {
wait(&xstatus);
if(xstatus != 0)
printf("FAILED\n", s);
printf("FAILED\n");
else
printf("OK\n", s);
printf("OK\n");
return xstatus == 0;
}
}