From 56ab6ab1594e71b690ace9b813fb31b465693acb Mon Sep 17 00:00:00 2001 From: Matthias Welwarsky Date: Fri, 16 Sep 2016 15:36:09 +0200 Subject: [PATCH] aarch64: fix armv8_set_core_reg when destination is cpsr When armv8_set_core_reg is used to set the value of the CPSR, also update the internal architecture state. Change-Id: I5f6a2be6fde8d91ec3352d8ba23c4aa90eb02977 Signed-off-by: Matthias Welwarsky --- src/target/armv8.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/target/armv8.c b/src/target/armv8.c index 176c7adf..ad067963 100644 --- a/src/target/armv8.c +++ b/src/target/armv8.c @@ -845,14 +845,20 @@ static int armv8_set_core_reg(struct reg *reg, uint8_t *buf) { struct arm_reg *armv8_reg = reg->arch_info; struct target *target = armv8_reg->target; + struct arm *arm = target_to_arm(target); uint64_t value = buf_get_u64(buf, 0, 64); if (target->state != TARGET_HALTED) return ERROR_TARGET_NOT_HALTED; - buf_set_u64(reg->value, 0, 64, value); + if (reg == arm->cpsr) { + armv8_set_cpsr(arm, (uint32_t)value); + } else { + buf_set_u64(reg->value, 0, 64, value); + reg->valid = 1; + } + reg->dirty = 1; - reg->valid = 1; return ERROR_OK; } -- 2.39.5