summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Andrew Waterman <waterman@cs.berkeley.edu>2015-04-02 13:54:48 -0700
committerGravatar Andrew Waterman <waterman@cs.berkeley.edu>2015-04-02 13:55:11 -0700
commit80529256d64bf70e1cf2279d7a896dc5e338aa4d (patch)
tree7f9e2ea6fca34fc6eb3cc11c1b9581a7aca6b725
parentba8498f052fda83eda73fd3563f3a160a2ec10d7 (diff)
Distinguish Sv39/Sv48; reserve some PPN bits
-rw-r--r--Makefile2
-rw-r--r--encoding.h10
2 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index f10f353..54e9999 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ ALL_OPCODES := opcodes opcodes-pseudo opcodes-rvc opcodes-hwacha opcodes-hwacha-
install: $(ISASIM_H) $(PK_H) $(FESVR_H) $(ENV_H) $(GAS_H) $(XCC_H) inst.chisel instr-table.tex
-$(ISASIM_H) $(PK_H) $(FESVR_H) $(ENV_H): $(ALL_OPCODES) parse-opcodes
+$(ISASIM_H) $(PK_H) $(FESVR_H) $(ENV_H): $(ALL_OPCODES) parse-opcodes encoding.h
cp encoding.h $@
cat opcodes opcodes-rvc | ./parse-opcodes -c >> $@
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)