Skip to content

Commit 84a212e

Browse files
committed
pointer masking: Always apply sstatus.MXR regardless of effective V
ISA spec says "Setting MXR at HS-level overrides both VS-stage and G-stage execute-only permissions."
1 parent 272c149 commit 84a212e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

riscv/mmu.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ void mmu_t::register_memtracer(memtracer_t* t)
614614
}
615615

616616
reg_t mmu_t::get_pmlen(bool effective_virt, reg_t effective_priv, xlate_flags_t flags) const {
617-
if (!proc || proc->get_xlen() != 64 || (proc->state.sstatus->readvirt(effective_virt) & MSTATUS_MXR) || flags.hlvx)
617+
if (!proc || proc->get_xlen() != 64 || ((proc->state.sstatus->readvirt(false) | proc->state.sstatus->readvirt(effective_virt)) & MSTATUS_MXR) || flags.hlvx)
618618
return 0;
619619

620620
reg_t pmm = 0;

0 commit comments

Comments
 (0)