mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.6k stars 2.38k forks source link

trampoline.S uservec and trampoline symbols are identical #113

Closed mallicksm closed 1 year ago

mallicksm commented 2 years ago

trap.c:100 w_stvec(TRAMPOLINE + (uservec - trampoline)) should read w_stvec(TRAMPOLINE)

kaashoek commented 1 year ago

Agree doesn't break anything and is shorter. The reason for the "+ (uservec - trampoline)" is to make sure that the user jumps to uservec, which might not be at the start of TRAMPOLINE. (Though it happens to be at the start.) Keeping it is also makes the code symmetric for call and return.