don't set badvaddr for instruction access faults
authorAndrew Waterman <waterman@s143.Millennium.Berkeley.EDU>
Tue, 31 Jan 2012 00:30:02 +0000 (16:30 -0800)
committerAndrew Waterman <waterman@s143.Millennium.Berkeley.EDU>
Tue, 31 Jan 2012 00:30:02 +0000 (16:30 -0800)
riscv/mmu.cc

index aa62b902571e868745493fda9ba28f5757c6d052..55273f328d7f5222ae9c417b24f603997baccf93 100644 (file)
@@ -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;