This is an automated email from Gerrit.

Matthias Welwarsky (matth...@welwarsky.de) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/3762

-- gerrit

commit ce4f0a1382ade81cc270d3de018a62390439e9b2
Author: Matthias Welwarsky <matthias.welwar...@sysgo.com>
Date:   Fri Sep 16 15:36:09 2016 +0200

    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.welwar...@sysgo.com>

diff --git a/src/target/armv8.c b/src/target/armv8.c
index 09e7ec3..14e932c 100644
--- a/src/target/armv8.c
+++ b/src/target/armv8.c
@@ -851,14 +851,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;
 }

-- 

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

Reply via email to