summaryrefslogtreecommitdiff
path: root/kernel/trap.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2022-08-09 11:44:02 -0400
committerRobert Morris <[email protected]>2022-08-09 11:44:02 -0400
commit9fc9f755e1f9ec56a452b334f6112028e0ec0329 (patch)
tree5bc1ab85b436fde1bd4f6d72ed9c577919b92141 /kernel/trap.c
parentca6fc549341d30730247792b87edceacf1613834 (diff)
downloadxv6-labs-9fc9f755e1f9ec56a452b334f6112028e0ec0329.tar.gz
xv6-labs-9fc9f755e1f9ec56a452b334f6112028e0ec0329.tar.bz2
xv6-labs-9fc9f755e1f9ec56a452b334f6112028e0ec0329.zip
adopt github PR98 (No need to store TRAPFRAME in sscratch register)
Diffstat (limited to 'kernel/trap.c')
-rw-r--r--kernel/trap.c11
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,