diff options
author | Tarek BOCHKATI <tarek.bouchkati@gmail.com> | 2021-02-14 12:39:33 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-06-13 19:58:51 +0100 |
commit | 21e1ebdc8e548f0db5fe5e2f90fb1cfc49cc53b0 (patch) | |
tree | 64c58ac6fa9286dfcdd05db6de2f625c720d119d /src | |
parent | 64c2e03b23d9cadc1b919d38e902a079d015ddc6 (diff) | |
download | riscv-openocd-21e1ebdc8e548f0db5fe5e2f90fb1cfc49cc53b0.zip riscv-openocd-21e1ebdc8e548f0db5fe5e2f90fb1cfc49cc53b0.tar.gz riscv-openocd-21e1ebdc8e548f0db5fe5e2f90fb1cfc49cc53b0.tar.bz2 |
armv8_dpm: do not read/write non-existent registers
Change-Id: I0f3fffa8cf1746569f6acce0233e9544d3862f51
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6062
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/armv8_dpm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/target/armv8_dpm.c b/src/target/armv8_dpm.c index 6ef8c33..b36ef83 100644 --- a/src/target/armv8_dpm.c +++ b/src/target/armv8_dpm.c @@ -782,7 +782,7 @@ int armv8_dpm_read_current_registers(struct arm_dpm *dpm) struct arm_reg *arm_reg; r = armv8_reg_current(arm, i); - if (r->valid) + if (!r->exist || r->valid) continue; /* Skip reading FP-SIMD registers */ @@ -922,6 +922,9 @@ int armv8_dpm_write_dirty_registers(struct arm_dpm *dpm, bool bpwp) for (unsigned i = 1; i < cache->num_regs; i++) { struct arm_reg *r; + /* skip non-existent */ + if (!cache->reg_list[i].exist) + continue; /* skip PC and CPSR */ if (i == ARMV8_PC || i == ARMV8_xPSR) continue; @@ -1047,7 +1050,7 @@ static int armv8_dpm_full_context(struct target *target) for (unsigned i = 0; i < cache->num_regs; i++) { struct arm_reg *r; - if (cache->reg_list[i].valid) + if (!cache->reg_list[i].exist || cache->reg_list[i].valid) continue; r = cache->reg_list[i].arch_info; |