2020-01-21 10:14:13 +00:00
|
|
|
#if __riscv_xlen == 64
|
|
|
|
# define STORE sd
|
|
|
|
# define LOAD ld
|
|
|
|
# define LOG_REGBYTES 3
|
|
|
|
#else
|
|
|
|
# define STORE sw
|
|
|
|
# define LOAD lw
|
|
|
|
# define LOG_REGBYTES 2
|
|
|
|
#endif
|
|
|
|
#define REGBYTES (1 << LOG_REGBYTES)
|
|
|
|
|
2020-01-24 03:34:56 +00:00
|
|
|
.global enable_mmu
|
2020-01-23 02:29:20 +00:00
|
|
|
.global return_from_interrupt
|
2020-01-21 10:14:13 +00:00
|
|
|
.text
|
2020-01-24 03:34:56 +00:00
|
|
|
enable_mmu:
|
|
|
|
la sp, _estack // Trash the stack and start over
|
2020-01-23 02:29:20 +00:00
|
|
|
return_from_interrupt:
|
2020-01-21 10:14:13 +00:00
|
|
|
mret // Return to kmain
|
2020-01-21 12:05:39 +00:00
|
|
|
|
2020-01-24 03:34:56 +00:00
|
|
|
.global flush_mmu
|
|
|
|
flush_mmu:
|
|
|
|
sfence.vma
|
|
|
|
ret
|
|
|
|
|
|
|
|
.global my_fence
|
2020-01-21 12:05:39 +00:00
|
|
|
.global read_satp
|
|
|
|
.text
|
|
|
|
read_satp:
|
|
|
|
csrr a0, satp
|
|
|
|
ret
|