diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-06-11 19:08:18 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-06-11 19:08:18 +0300 |
| commit | 426da8be0db33405b0cfe53108b65040623972f0 (patch) | |
| tree | c1776cf14695d717a92d5d46d7a07c978a0e3618 /arch/riscv64/kernel/entry.S | |
| parent | de99380f12f8e2fe4acf7734db0e1e37a356c45f (diff) | |
| download | kmi-426da8be0db33405b0cfe53108b65040623972f0.tar.gz kmi-426da8be0db33405b0cfe53108b65040623972f0.zip | |
continue documentation
Diffstat (limited to 'arch/riscv64/kernel/entry.S')
| -rw-r--r-- | arch/riscv64/kernel/entry.S | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S index a5427a7..ee7b10f 100644 --- a/arch/riscv64/kernel/entry.S +++ b/arch/riscv64/kernel/entry.S @@ -25,8 +25,8 @@ _save_context: sr sp, offsetof_sp(tp) mv sp, tp - /* set scratch to 0 and move thread pointer back */ - csrrw tp, CSR_SSCRATCH, x0 + /* move thread pointer back */ + csrrw tp, CSR_SSCRATCH, tp /* save registers */ sr ra, offsetof_ra(sp) @@ -60,6 +60,10 @@ _save_context: sr t5, offsetof_t5(sp) sr t6, offsetof_t6(sp) + /* get current tcb into tp and set scratch to 0 so we can figure out if + * exception occured in kernel or userspace */ + csrrw tp, CSR_SSCRATCH, x0 + /* load supervisor cause */ csrr s4, CSR_SCAUSE /* interrupts fall through, exceptions jump */ @@ -85,9 +89,6 @@ handle_syscall: /* TODO: is a whole function call necessary? */ mv s0, a0 mv s1, a1 - /* get current tcb */ - call cur_tcb - mv tp, a0 /* get associated kernel stack */ mv sp, tp addi sp, sp, -sizeof_registers |
