From: Antonio Borneo Date: Sun, 22 Nov 2020 11:29:04 +0000 (+0100) Subject: arm7_9_common: fix host endianness bug in arm7_9_full_context() X-Git-Tag: v0.11.0-rc1~8 X-Git-Url: https://review.openocd.org/gitweb?a=commitdiff_plain;h=a56b7291911b4f42718d406dd2de857db4c11e0f;hp=a56b7291911b4f42718d406dd2de857db4c11e0f;p=openocd.git arm7_9_common: fix host endianness bug in arm7_9_full_context() The original code passes to ->read_core_regs() and to ->read_xpsr() the pointer to the little-endian buffer reg.value. This is incorrect because the two functions above require a pointer to uint32_t, since they already run the conversion with arm_le_to_h_u32() in the jtag callback. This causes a mismatch on big-endian host and the registers get read with the incorrect endianness. Use an intermediate buffer to read the registers as uint32_t and to track the destination reg.value pointer, then copy the value in reg.value after the call to jtag_execute_queue(). Tested with qemu-armeb and an OpenOCD built through buildroot configured for cortex-a7 big-endian. Note that if jtag_execute_queue() fails, the openocd register cache is not updated, so the already modified flags 'valid' and 'dirty' are incorrect. This part should be moved after the call to jtag_execute_queue() too. Change-Id: Iba70d964ffbb74bf0860bfd9d299f218e3bc65bf Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/5943 Tested-by: jenkins Reviewed-by: Andreas Fritiofson ---