diff options
Diffstat (limited to 'riscv.h')
-rw-r--r-- | riscv.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -129,7 +129,7 @@ w_sscratch(uint64 x) asm("csrw sscratch, %0" : : "r" (x)); } -// Supervisor trap cause +// Supervisor Trap Cause static inline uint64 r_scause() { @@ -138,6 +138,15 @@ r_scause() return x; } +// Supervisor Trap Value +static inline uint64 +r_stval() +{ + uint64 x; + asm("csrr %0, stval" : "=r" (x) ); + return x; +} + #define PGSIZE 4096 // bytes per page #define PGSHIFT 12 // bits of offset within a page |