aboutsummaryrefslogtreecommitdiff
path: root/encoding.h
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-04-02 13:54:48 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-04-02 13:55:11 -0700
commit80529256d64bf70e1cf2279d7a896dc5e338aa4d (patch)
tree7f9e2ea6fca34fc6eb3cc11c1b9581a7aca6b725 /encoding.h
parentba8498f052fda83eda73fd3563f3a160a2ec10d7 (diff)
downloadriscv-opcodes-80529256d64bf70e1cf2279d7a896dc5e338aa4d.zip
riscv-opcodes-80529256d64bf70e1cf2279d7a896dc5e338aa4d.tar.gz
riscv-opcodes-80529256d64bf70e1cf2279d7a896dc5e338aa4d.tar.bz2
Distinguish Sv39/Sv48; reserve some PPN bits
Diffstat (limited to 'encoding.h')
-rw-r--r--encoding.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/encoding.h b/encoding.h
index 631a40f..b731f50 100644
--- a/encoding.h
+++ b/encoding.h
@@ -48,7 +48,8 @@
#define VM_MBB 1
#define VM_MBBID 2
#define VM_SV32 4
-#define VM_SV43 5
+#define VM_SV39 5
+#define VM_SV48 6
#define UA_RV32 0
#define UA_RV64 4
@@ -69,7 +70,8 @@
#define PTE_R 0x040 // Referenced
#define PTE_D 0x080 // Dirty
#define PTE_SOFT 0x300 // Reserved for Software
-#define PTE_PPN_SHIFT 10
+#define RV64_PTE_PPN_SHIFT 26
+#define RV32_PTE_PPN_SHIFT 10
#define PTE_TYPE_INVALID 0
#define PTE_TYPE_TABLE 1
#define PTE_TYPE_U 2
@@ -105,13 +107,13 @@
# define MSTATUS_HA MSTATUS64_HA
# define MSTATUS_SD MSTATUS64_SD
# define SSTATUS_SD SSTATUS64_SD
-# define RISCV_PGLEVELS 3 /* Sv39 */
# define RISCV_PGLEVEL_BITS 9
+# define PTE_PPN_SHIFT RV64_PTE_PPN_SHIFT
#else
# define MSTATUS_SD MSTATUS32_SD
# define SSTATUS_SD SSTATUS32_SD
-# define RISCV_PGLEVELS 2 /* Sv32 */
# define RISCV_PGLEVEL_BITS 10
+# define PTE_PPN_SHIFT RV32_PTE_PPN_SHIFT
#endif
#define RISCV_PGSHIFT 12
#define RISCV_PGSIZE (1 << RISCV_PGSHIFT)