From 50cbc7510250a64674d619d13f5912edf08b767d Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Sat, 1 Jun 2019 05:33:38 -0400 Subject: first shell prints $ prompt, though no console input yet --- riscv.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'riscv.h') diff --git a/riscv.h b/riscv.h index 92fa6e3..5e54935 100644 --- a/riscv.h +++ b/riscv.h @@ -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 -- cgit v1.2.3