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 <matthias.welwarsky@sysgo.com>
gitignore-build
Matthias Welwarsky 2016-09-16 15:36:09 +02:00
parent 4afa32ece1
commit 56ab6ab159
1 changed files with 8 additions and 2 deletions

View File

@ -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;
}