mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:17:45 +00:00
Kernel/riscv64: Implement thread_context_first_enter
thread_context_first_enter reuses the context restoring code in the trap handler, just like other arches already do. The `ld x2, 1*8(sp)` is unnecessary in the trap handler, as the stack pointer should be equal to the stack pointer slot in the RegisterState if the trap is from supervisor mode (and we currently don't support user traps). This load will however make us unable to reuse that code for thread_context_first_enter.
This commit is contained in:
parent
7fbcceb657
commit
efdc433ebc
2 changed files with 18 additions and 4 deletions
|
@ -90,6 +90,9 @@ asm_trap_handler:
|
|||
|
||||
call trap_handler
|
||||
|
||||
.global restore_context_and_sret
|
||||
restore_context_and_sret:
|
||||
|
||||
// Remove TrapFrame from the stack
|
||||
addi sp, sp, 16
|
||||
|
||||
|
@ -131,7 +134,5 @@ asm_trap_handler:
|
|||
ld x30, 29*8(sp)
|
||||
ld x31, 30*8(sp)
|
||||
|
||||
ld x2, 1*8(sp)
|
||||
|
||||
addi sp, sp, REGISTER_STATE_SIZE
|
||||
sret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue