File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3035,14 +3035,16 @@ static int riscv_mmu(struct target *target, int *enabled)
3035
3035
unsigned int xlen = riscv_xlen (target );
3036
3036
3037
3037
if (v_mode ) {
3038
+ /* In VU or VS mode, MMU is considered enabled when
3039
+ * either hgatp or vsatp mode is not OFF */
3038
3040
riscv_reg_t vsatp ;
3039
3041
if (riscv_reg_get (target , & vsatp , GDB_REGNO_VSATP ) != ERROR_OK ) {
3040
3042
LOG_TARGET_ERROR (target , "Failed to read vsatp register; priv=0x%" PRIx64 ,
3041
3043
priv );
3042
3044
return ERROR_FAIL ;
3043
3045
}
3044
3046
/* vsatp is identical to satp, so we can use the satp macros. */
3045
- if (RISCV_SATP_MODE (xlen ) != SATP_MODE_OFF ) {
3047
+ if (get_field ( vsatp , RISCV_SATP_MODE (xlen ) ) != SATP_MODE_OFF ) {
3046
3048
LOG_TARGET_DEBUG (target , "VS-stage translation is enabled." );
3047
3049
* enabled = 1 ;
3048
3050
return ERROR_OK ;
@@ -3054,7 +3056,7 @@ static int riscv_mmu(struct target *target, int *enabled)
3054
3056
priv );
3055
3057
return ERROR_FAIL ;
3056
3058
}
3057
- if (RISCV_HGATP_MODE (xlen ) != HGATP_MODE_OFF ) {
3059
+ if (get_field ( hgatp , RISCV_HGATP_MODE (xlen ) ) != HGATP_MODE_OFF ) {
3058
3060
LOG_TARGET_DEBUG (target , "G-stage address translation is enabled." );
3059
3061
* enabled = 1 ;
3060
3062
} else {
You can’t perform that action at this time.
0 commit comments