diff options
-rw-r--r-- | encoding.h | 10 | ||||
-rw-r--r-- | v/vm.c | 2 |
2 files changed, 7 insertions, 5 deletions
@@ -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) @@ -218,7 +218,7 @@ void vm_boot(long test_addr, long seed) write_csr(sptbr, l1pt); set_csr(mstatus, MSTATUS_IE1 | MSTATUS_FS | MSTATUS_XS | MSTATUS_MPRV); clear_csr(mstatus, MSTATUS_VM | MSTATUS_UA | MSTATUS_PRV1); - set_csr(mstatus, (long)VM_SV43 << __builtin_ctzl(MSTATUS_VM)); + set_csr(mstatus, (long)VM_SV39 << __builtin_ctzl(MSTATUS_VM)); set_csr(mstatus, (long)UA_RV64 << __builtin_ctzl(MSTATUS_UA)); seed = 1 + (seed % MAX_TEST_PAGES); |