From e1060ac43d1f7a99d81fef1d498cca6392ddcf1d Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Sun, 28 Feb 2021 03:51:05 +0000 Subject: [PATCH] TlbTypes: Fix exception code reported for some store page fault conditions The mode and well-formedness checks above also set fault to True, so we end up with cases where a DataStore request uses the default load page fault exception code. Instead, unconditionally set excStorePageFault for DataStore, and conditionally override to excStoreCapPageFault when appropriate, being particularly careful to ensure earlier exception causes still take precedence. Also restructure the InstFetch and DataLoad cases to match how DataStore needs to look. This fixes the rv64si-p-dirty ISA test, currently the sole failure. --- src_Core/RISCY_OOO/procs/lib/TlbTypes.bsv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src_Core/RISCY_OOO/procs/lib/TlbTypes.bsv b/src_Core/RISCY_OOO/procs/lib/TlbTypes.bsv index 084990e..cc699a9 100644 --- a/src_Core/RISCY_OOO/procs/lib/TlbTypes.bsv +++ b/src_Core/RISCY_OOO/procs/lib/TlbTypes.bsv @@ -228,28 +228,28 @@ function TlbPermissionCheck hasVMPermission( // check execute/read/write permission case(access) InstFetch: begin + excCode = excLoadPageFault; if(!pte_type.executable) begin fault = True; end - excCode = excLoadPageFault; end DataLoad: begin + excCode = excLoadPageFault; // need to consider mstatus.mxr bit if (!pte_type.readable && !(pte_type.executable && vm_info.exeReadable)) begin fault = True; end - excCode = excLoadPageFault; end DataStore: begin + excCode = excStorePageFault; // store requires page to be both readable and writable if(!(pte_type.readable && pte_type.writable)) begin fault = True; - excCode = excStorePageFault; end else if(cap && !pte_upper_type.cap_writable) begin + if (!fault) excCode = excStoreCapPageFault; fault = True; - excCode = excStoreCapPageFault; end end endcase