From 1b797b1aac81b318900bd11065eb64762f32894f Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 12 Jul 2016 12:43:07 -0700 Subject: [PATCH] Fix page table walker not respecting valid bit --- riscv/mmu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv/mmu.cc b/riscv/mmu.cc index 602b090..4b7166f 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -153,7 +153,7 @@ reg_t mmu_t::walk(reg_t addr, access_type type, reg_t mode) base = ppn << PGSHIFT; } else if ((pte & PTE_U) ? supervisor && pum : !supervisor) { break; - } else if (!(pte & PTE_R) && (pte & PTE_W)) { // reserved + } else if (!(pte & PTE_V) || (!(pte & PTE_R) && (pte & PTE_W))) { break; } else if (type == FETCH ? !(pte & PTE_X) : type == LOAD ? !(pte & PTE_R) && !(mxr && (pte & PTE_X)) : -- 2.30.2