From de247db5e6384b138f270e0a7c745989b5a9c23b Mon Sep 17 00:00:00 2001
From: Robert Morris <rtm@csail.mit.edu>
Date: Wed, 4 Sep 2024 17:29:58 -0400
Subject: [PATCH] menvcfg also

---
 kernel/riscv.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/riscv.h b/kernel/riscv.h
index d80e78e..f7aaa8a 100644
--- a/kernel/riscv.h
+++ b/kernel/riscv.h
@@ -196,14 +196,16 @@ static inline uint64
 r_menvcfg()
 {
   uint64 x;
-  asm volatile("csrr %0, menvcfg" : "=r" (x) );
+  // asm volatile("csrr %0, menvcfg" : "=r" (x) );
+  asm volatile("csrr %0, 0x30a" : "=r" (x) );
   return x;
 }
 
 static inline void 
 w_menvcfg(uint64 x)
 {
-  asm volatile("csrw menvcfg, %0" : : "r" (x));
+  // asm volatile("csrw menvcfg, %0" : : "r" (x));
+  asm volatile("csrw 0x30a, %0" : : "r" (x));
 }
 
 // Physical Memory Protection