diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-25 22:26:16 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-25 22:26:16 +0100 |
| commit | 035da8e4499b0ef3b0417b3bbf9bd82c566ea220 (patch) | |
| tree | 9182879dba20688e5b152e4fa2dbbe2c7ec53f34 /include | |
| parent | 226c5c2e070b9831e3cbc81e9894b8048f8a932d (diff) | |
| download | fbos-035da8e4499b0ef3b0417b3bbf9bd82c566ea220.tar.gz fbos-035da8e4499b0ef3b0417b3bbf9bd82c566ea220.zip | |
kernel: Don't tamper the 'ra' register on switch
As part of a shameful hack I was tampering with the 'ra' register as
well as with the 'sepc' CSR. Since in the end we just assume 'sret' is
in place at the end, let's be cleaner and leave 'ra' alone.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/fbos/sched.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/fbos/sched.h b/include/fbos/sched.h index 3d35f9f..00f3e70 100644 --- a/include/fbos/sched.h +++ b/include/fbos/sched.h @@ -33,9 +33,10 @@ extern struct task_struct tasks[4]; __kernel __always_inline void switch_to(int task_id) { asm volatile("csrc sstatus, %0\n\t" - "mv ra, %1\n\t" - "csrw sepc, ra" ::"r"(1 << 8), - "r"(tasks[task_id].entry_addr)); + "mv t0, %1\n\t" + "csrw sepc, t0" ::"r"(1 << 8), + "r"(tasks[task_id].entry_addr) + : "t0"); } #endif // __FBOS_SCHED_H_ |
