This is an automated email from Gerrit.

Cheng-Shiun Tsai (cheng.shiun.t...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6051

-- gerrit

commit aa45e5e60ce4ab56225b14c8740e04ef8f1e89f2
Author: Cheng-Shiun Tsai <cheng.shiun.t...@gmail.com>
Date:   Sat Feb 6 23:04:14 2021 +0000

    Aarch64:Switch to EL1 from EL0 before manipulate MMU
    
    If current core is in EL0, it cannot use 'msr sctlr_el1, x0'
    
    Change-Id: I04e60e39e4c84f9d9de7cc87a8e438f5d2737dc3
    Signed-off-by:Cheng-Shiun Tsai <cheng.shiun.t...@gmail.com>

diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index d111a05..a411d7a 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -184,9 +184,16 @@ static int aarch64_mmu_modify(struct target *target, int 
enable)
                LOG_DEBUG("unknown cpu state 0x%x", armv8->arm.core_mode);
                break;
        }
-
+       if (armv8->arm.core_mode == ARMV8_64_EL0T) {
+               LOG_DEBUG("Switch to EL1 to manipulate MMU");
+               armv8_dpm_modeswitch(&armv8->dpm, ARMV8_64_EL1H);
+       }
        retval = armv8->dpm.instr_write_data_r0(&armv8->dpm, instr,
                                aarch64->system_control_reg_curr);
+       if (armv8->arm.core_mode == ARMV8_64_EL0T) {
+               LOG_DEBUG("Switch back to EL0");
+               armv8_dpm_modeswitch(&armv8->dpm, ARM_MODE_ANY);
+       }
        return retval;
 }
 

-- 


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to