diff options
author | Robert Morris <[email protected]> | 2022-08-09 11:44:02 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2022-08-09 11:44:02 -0400 |
commit | 9fc9f755e1f9ec56a452b334f6112028e0ec0329 (patch) | |
tree | 5bc1ab85b436fde1bd4f6d72ed9c577919b92141 /kernel/trap.c | |
parent | ca6fc549341d30730247792b87edceacf1613834 (diff) | |
download | xv6-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.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, |