don't enable interrupts until done with sstatus, scause, &c
This commit is contained in:
parent
abfe9999f4
commit
40f1041a0a
|
@ -50,8 +50,6 @@ usertrap(void)
|
||||||
// save user program counter.
|
// save user program counter.
|
||||||
p->tf->epc = r_sepc();
|
p->tf->epc = r_sepc();
|
||||||
|
|
||||||
intr_on();
|
|
||||||
|
|
||||||
if(r_scause() == 8){
|
if(r_scause() == 8){
|
||||||
// system call
|
// system call
|
||||||
|
|
||||||
|
@ -59,11 +57,15 @@ usertrap(void)
|
||||||
// but we want to return to the next instruction.
|
// but we want to return to the next instruction.
|
||||||
p->tf->epc += 4;
|
p->tf->epc += 4;
|
||||||
|
|
||||||
|
// an interrupt will change sstatus &c registers,
|
||||||
|
// so don't enable until done with those registers.
|
||||||
|
intr_on();
|
||||||
|
|
||||||
syscall();
|
syscall();
|
||||||
} else if((which_dev = devintr()) != 0){
|
} else if((which_dev = devintr()) != 0){
|
||||||
// ok
|
// ok
|
||||||
} else {
|
} else {
|
||||||
printf("usertrap(): unexpected scause 0x%p pid=%d\n", r_scause(), p->pid);
|
printf("usertrap(): unexpected scause %p pid=%d\n", r_scause(), p->pid);
|
||||||
printf(" sepc=%p stval=%p\n", r_sepc(), r_stval());
|
printf(" sepc=%p stval=%p\n", r_sepc(), r_stval());
|
||||||
p->killed = 1;
|
p->killed = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue