diff options
author | Frans Kaashoek <[email protected]> | 2022-08-23 11:01:06 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2022-08-23 11:01:06 -0400 |
commit | ccb7bd14c7303a77f8f99928e2297ddd815674b1 (patch) | |
tree | ac9fc9f6773c87d5adc8ded3bc8bc3a0145e85cd /kernel/trap.c | |
parent | 4cd4d194b8827af4971a81ad28968499925f884f (diff) | |
parent | 8621be8f3d105cd73ffbc681f9810d04b083b0ae (diff) | |
download | xv6-labs-ccb7bd14c7303a77f8f99928e2297ddd815674b1.tar.gz xv6-labs-ccb7bd14c7303a77f8f99928e2297ddd815674b1.tar.bz2 xv6-labs-ccb7bd14c7303a77f8f99928e2297ddd815674b1.zip |
Merge branch 'riscv' into uvm-perm
Diffstat (limited to 'kernel/trap.c')
-rw-r--r-- | kernel/trap.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/trap.c b/kernel/trap.c index 75fb3ec..512c850 100644 --- a/kernel/trap.c +++ b/kernel/trap.c @@ -53,15 +53,15 @@ usertrap(void) if(r_scause() == 8){ // system call - if(p->killed) + if(killed(p)) exit(-1); // sepc points to the ecall instruction, // but we want to return to the next instruction. p->trapframe->epc += 4; - // an interrupt will change sstatus &c registers, - // so don't enable until done with those registers. + // an interrupt will change sepc, scause, and sstatus, + // so enable only now that we're done with those registers. intr_on(); syscall(); @@ -70,10 +70,10 @@ usertrap(void) } else { printf("usertrap(): unexpected scause %p pid=%d\n", r_scause(), p->pid); printf(" sepc=%p stval=%p\n", r_sepc(), r_stval()); - p->killed = 1; + setkilled(p); } - if(p->killed) + if(killed(p)) exit(-1); // give up the CPU if this is a timer interrupt. @@ -101,7 +101,7 @@ usertrapret(void) w_stvec(trampoline_uservec); // set up trapframe values that uservec will need when - // the process next re-enters the kernel. + // the process next traps into the kernel. p->trapframe->kernel_satp = r_satp(); // kernel page table p->trapframe->kernel_sp = p->kstack + PGSIZE; // process's kernel stack p->trapframe->kernel_trap = (uint64)usertrap; |