This is an automated email from Gerrit.

"Daniel Goehring <dgoeh...@os.amperecomputing.com>" just uploaded a new patch 
set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8801

-- gerrit

commit f4c002c9b22525aca2614381fa4b2337a0e1b3ec
Author: Daniel Goehring <dgoeh...@os.amperecomputing.com>
Date:   Thu Mar 6 10:55:20 2025 -0500

    target/armv8: fix 128-bit register writes
    
    Assert checking was recently added to the "buf_get_u64()"
    procedure for the buffer size argument.
    
    For 128-bit register writes, instead of calling "buf_get_u64()" with
    a 128-bit argument which fails the assert check, use two 64-bit calls.
    
    Change-Id: I32ddbdb7bbe68c43f3b0a27738537391a227b08c
    Signed-off-by: Daniel Goehring <dgoeh...@os.amperecomputing.com>

diff --git a/src/target/armv8.c b/src/target/armv8.c
index 50a9f46883..40390731e8 100644
--- a/src/target/armv8.c
+++ b/src/target/armv8.c
@@ -1686,12 +1686,12 @@ 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, reg->size);
 
        if (target->state != TARGET_HALTED)
                return ERROR_TARGET_NOT_HALTED;
 
        if (reg->size <= 64) {
+               uint64_t value = buf_get_u64(buf, 0, reg->size);
                if (reg == arm->cpsr)
                        armv8_set_cpsr(arm, (uint32_t)value);
                else {
@@ -1699,6 +1699,7 @@ static int armv8_set_core_reg(struct reg *reg, uint8_t 
*buf)
                        reg->valid = true;
                }
        } else if (reg->size <= 128) {
+               uint64_t value = buf_get_u64(buf, 0, 64);
                uint64_t hvalue = buf_get_u64(buf + 8, 0, reg->size - 64);
 
                buf_set_u64(reg->value, 0, 64, value);

-- 

Reply via email to