From ace6db857d06e01e06677a4c1df6596dfe793677 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 30 Jan 2012 16:30:02 -0800 Subject: [PATCH] don't set badvaddr for instruction access faults --- riscv/mmu.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/riscv/mmu.cc b/riscv/mmu.cc index aa62b90..55273f3 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -42,10 +42,11 @@ void* mmu_t::refill(reg_t addr, bool store, bool fetch) reg_t perm = (fetch ? PTE_UX : store ? PTE_UW : PTE_UR) | PTE_E; if(unlikely((pte_perm & perm) != perm)) { + if (fetch) + throw trap_instruction_access_fault; + badvaddr = addr; - throw store ? trap_store_access_fault - : fetch ? trap_instruction_access_fault - : trap_load_access_fault; + throw store ? trap_store_access_fault : trap_load_access_fault; } tlb_load_tag[idx] = (pte_perm & PTE_UR) ? expected_tag : -1; -- 2.30.2