@@ -431,7 +431,7 @@ reg_t cause_csr_t::read() const noexcept {
431431// implement class base_status_csr_t
432432base_status_csr_t ::base_status_csr_t (processor_t * const proc, const reg_t addr):
433433 csr_t (proc, addr),
434- has_page(proc->extension_enabled_const (' S' ) && proc->supports_impl(IMPL_MMU )),
434+ has_page(proc->extension_enabled_const (' S' ) && proc->has_mmu( )),
435435 sstatus_write_mask(compute_sstatus_write_mask()),
436436 sstatus_read_mask(sstatus_write_mask | SSTATUS_UBE | SSTATUS_UXL
437437 | (proc->get_const_xlen () == 32 ? SSTATUS32_SD : SSTATUS64_SD)) {
@@ -1005,7 +1005,7 @@ bool medeleg_csr_t::unlogged_write(const reg_t val) noexcept {
10051005 | (1 << CAUSE_STORE_ACCESS)
10061006 | (1 << CAUSE_USER_ECALL)
10071007 | (1 << CAUSE_SUPERVISOR_ECALL)
1008- | (proc->supports_impl (IMPL_MMU ) ? mmu_exceptions : 0 )
1008+ | (proc->has_mmu ( ) ? mmu_exceptions : 0 )
10091009 | (proc->extension_enabled (' H' ) ? hypervisor_exceptions : 0 )
10101010 | (1 << CAUSE_SOFTWARE_CHECK_FAULT)
10111011 | (1 << CAUSE_HARDWARE_ERROR_FAULT)
@@ -1088,7 +1088,7 @@ base_atp_csr_t::base_atp_csr_t(processor_t* const proc, const reg_t addr):
10881088}
10891089
10901090bool base_atp_csr_t::unlogged_write (const reg_t val) noexcept {
1091- const reg_t newval = proc->supports_impl (IMPL_MMU ) ? compute_new_satp (val) : 0 ;
1091+ const reg_t newval = proc->has_mmu ( ) ? compute_new_satp (val) : 0 ;
10921092 if (newval != read ())
10931093 proc->get_mmu ()->flush_tlb ();
10941094 return basic_csr_t::unlogged_write (newval);
@@ -1097,16 +1097,16 @@ bool base_atp_csr_t::unlogged_write(const reg_t val) noexcept {
10971097bool base_atp_csr_t::satp_valid (reg_t val) const noexcept {
10981098 if (proc->get_xlen () == 32 ) {
10991099 switch (get_field (val, SATP32_MODE)) {
1100- case SATP_MODE_SV32: return proc->supports_impl (IMPL_MMU_SV32);
11011100 case SATP_MODE_OFF: return true ;
1101+ case SATP_MODE_SV32: return proc->get_max_vaddr_bits () >= 32 ;
11021102 default : return false ;
11031103 }
11041104 } else {
11051105 switch (get_field (val, SATP64_MODE)) {
1106- case SATP_MODE_SV39: return proc->supports_impl (IMPL_MMU_SV39);
1107- case SATP_MODE_SV48: return proc->supports_impl (IMPL_MMU_SV48);
1108- case SATP_MODE_SV57: return proc->supports_impl (IMPL_MMU_SV57);
11091106 case SATP_MODE_OFF: return true ;
1107+ case SATP_MODE_SV39: return proc->get_max_vaddr_bits () >= 39 ;
1108+ case SATP_MODE_SV48: return proc->get_max_vaddr_bits () >= 48 ;
1109+ case SATP_MODE_SV57: return proc->get_max_vaddr_bits () >= 57 ;
11101110 default : return false ;
11111111 }
11121112 }
@@ -1345,9 +1345,9 @@ bool hgatp_csr_t::unlogged_write(const reg_t val) noexcept {
13451345 (proc->supports_impl (IMPL_MMU_VMID) ? HGATP64_VMID : 0 );
13461346
13471347 if (get_field (val, HGATP64_MODE) == HGATP_MODE_OFF ||
1348- (proc->supports_impl (IMPL_MMU_SV39) && get_field (val, HGATP64_MODE) == HGATP_MODE_SV39X4) ||
1349- (proc->supports_impl (IMPL_MMU_SV48) && get_field (val, HGATP64_MODE) == HGATP_MODE_SV48X4) ||
1350- (proc->supports_impl (IMPL_MMU_SV57) && get_field (val, HGATP64_MODE) == HGATP_MODE_SV57X4))
1348+ (proc->get_max_vaddr_bits () >= 39 && get_field (val, HGATP64_MODE) == HGATP_MODE_SV39X4) ||
1349+ (proc->get_max_vaddr_bits () >= 48 && get_field (val, HGATP64_MODE) == HGATP_MODE_SV48X4) ||
1350+ (proc->get_max_vaddr_bits () >= 57 && get_field (val, HGATP64_MODE) == HGATP_MODE_SV57X4))
13511351 mask |= HGATP64_MODE;
13521352 }
13531353 mask &= ~(reg_t )3 ;
@@ -2037,7 +2037,7 @@ hstatus_csr_t::hstatus_csr_t(processor_t* const proc, const reg_t addr):
20372037bool hstatus_csr_t::unlogged_write (const reg_t val) noexcept {
20382038 const reg_t mask = (proc->extension_enabled (EXT_SVUKTE) ? HSTATUS_HUKTE : 0 )
20392039 | HSTATUS_VTSR | HSTATUS_VTW
2040- | (proc->supports_impl (IMPL_MMU ) ? HSTATUS_VTVM : 0 )
2040+ | (proc->has_mmu ( ) ? HSTATUS_VTVM : 0 )
20412041 | (proc->extension_enabled (EXT_SSNPM) ? HSTATUS_HUPMM : 0 )
20422042 | HSTATUS_HU | HSTATUS_SPVP | HSTATUS_SPV | HSTATUS_GVA;
20432043
0 commit comments