summaryrefslogtreecommitdiff
path: root/riscv.h
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-06-01 05:33:38 -0400
committerRobert Morris <[email protected]>2019-06-01 05:33:38 -0400
commit50cbc7510250a64674d619d13f5912edf08b767d (patch)
tree874895d11adb72fed959619d85596b062260276f /riscv.h
parent7fd1f1eb0aab4d52852fc4f5e83eafc991f9a627 (diff)
downloadxv6-labs-50cbc7510250a64674d619d13f5912edf08b767d.tar.gz
xv6-labs-50cbc7510250a64674d619d13f5912edf08b767d.tar.bz2
xv6-labs-50cbc7510250a64674d619d13f5912edf08b767d.zip
first shell prints $ prompt, though no console input yet
Diffstat (limited to 'riscv.h')
-rw-r--r--riscv.h11
1 files changed, 10 insertions, 1 deletions
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