diff options
Diffstat (limited to 'kernel/trap.c')
-rw-r--r-- | kernel/trap.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/trap.c b/kernel/trap.c index a63249e..75fb3ec 100644 --- a/kernel/trap.c +++ b/kernel/trap.c @@ -96,8 +96,9 @@ usertrapret(void) // we're back in user space, where usertrap() is correct. intr_off(); - // send syscalls, interrupts, and exceptions to trampoline.S - w_stvec(TRAMPOLINE + (uservec - trampoline)); + // send syscalls, interrupts, and exceptions to uservec in trampoline.S + uint64 trampoline_uservec = TRAMPOLINE + (uservec - trampoline); + w_stvec(trampoline_uservec); // set up trapframe values that uservec will need when // the process next re-enters the kernel. @@ -121,11 +122,11 @@ usertrapret(void) // tell trampoline.S the user page table to switch to. uint64 satp = MAKE_SATP(p->pagetable); - // jump to trampoline.S at the top of memory, which + // jump to userret in trampoline.S at the top of memory, which // switches to the user page table, restores user registers, // and switches to user mode with sret. - uint64 fn = TRAMPOLINE + (userret - trampoline); - ((void (*)(uint64,uint64))fn)(TRAPFRAME, satp); + uint64 trampoline_userret = TRAMPOLINE + (userret - trampoline); + ((void (*)(uint64))trampoline_userret)(satp); } // interrupts and exceptions from kernel code go here via kernelvec, |