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)
30353035 unsigned int xlen = riscv_xlen (target );
30363036
30373037 if (v_mode ) {
3038+ /* In VU or VS mode, MMU is considered enabled when
3039+ * either hgatp or vsatp mode is not OFF */
30383040 riscv_reg_t vsatp ;
30393041 if (riscv_reg_get (target , & vsatp , GDB_REGNO_VSATP ) != ERROR_OK ) {
30403042 LOG_TARGET_ERROR (target , "Failed to read vsatp register; priv=0x%" PRIx64 ,
30413043 priv );
30423044 return ERROR_FAIL ;
30433045 }
30443046 /* 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 ) {
30463048 LOG_TARGET_DEBUG (target , "VS-stage translation is enabled." );
30473049 * enabled = 1 ;
30483050 return ERROR_OK ;
@@ -3054,7 +3056,7 @@ static int riscv_mmu(struct target *target, int *enabled)
30543056 priv );
30553057 return ERROR_FAIL ;
30563058 }
3057- if (RISCV_HGATP_MODE (xlen ) != HGATP_MODE_OFF ) {
3059+ if (get_field ( hgatp , RISCV_HGATP_MODE (xlen ) ) != HGATP_MODE_OFF ) {
30583060 LOG_TARGET_DEBUG (target , "G-stage address translation is enabled." );
30593061 * enabled = 1 ;
30603062 } else {
You can’t perform that action at this time.
0 commit comments