diff options
author | Matthias Welwarsky <matthias.welwarsky@sysgo.com> | 2017-01-19 16:57:04 +0100 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2017-01-20 08:28:35 +0000 |
commit | 59820c18d0d8be93344b00a10a2a4e56601fb094 (patch) | |
tree | 882858a0cc4c93f9d48a5d6d0f5ff4039a291dc7 /src | |
parent | 1c4aa20b21015340bd6dcfb03939c88b58506e5e (diff) | |
download | riscv-openocd-59820c18d0d8be93344b00a10a2a4e56601fb094.zip riscv-openocd-59820c18d0d8be93344b00a10a2a4e56601fb094.tar.gz riscv-openocd-59820c18d0d8be93344b00a10a2a4e56601fb094.tar.bz2 |
arm_dpm: avoid duplicating the register cache
This bug was already attempted to fix in an earlier patch but
merging the "defer-examine" feature caused a regression, which this patch
tries to fix again.
Change-Id: Ie1ad1516f0d7f130d44e003d6c29dcc1a02a82ca
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/3951
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/arm_dpm.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/target/arm_dpm.c b/src/target/arm_dpm.c index 8ad6575..62c6175 100644 --- a/src/target/arm_dpm.c +++ b/src/target/arm_dpm.c @@ -972,11 +972,14 @@ int arm_dpm_setup(struct arm_dpm *dpm) arm->read_core_reg = arm_dpm_read_core_reg; arm->write_core_reg = arm_dpm_write_core_reg; - cache = arm_build_reg_cache(target, arm); - if (!cache) - return ERROR_FAIL; + /* avoid duplicating the register cache */ + if (arm->core_cache == NULL) { + cache = arm_build_reg_cache(target, arm); + if (!cache) + return ERROR_FAIL; - *register_get_last_cache_p(&target->reg_cache) = cache; + *register_get_last_cache_p(&target->reg_cache) = cache; + } /* coprocessor access setup */ arm->mrc = dpm_mrc; |