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.
This commit is contained in:
Jessica Clarke
2021-02-28 03:51:05 +00:00
parent c7bd60b47e
commit e1060ac43d

View File

@@ -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