riscv-openocd/src
Antonio Borneo a56b729191 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 <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5943
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-12-05 23:18:29 +00:00
..
flash flash/nor/stm32f1x: fix error message 2020-11-15 22:10:02 +00:00
helper jep106: Add new IDs from JEDEC 2020-12-05 23:17:48 +00:00
jtag jtag/drivers/cmsis_dap: fix build with gcc 10.1.0 2020-11-15 21:38:29 +00:00
pld openocd: use proper format with uint32_t 2020-09-05 17:12:44 +01:00
rtos rtos: make private the API rtos_try_next() 2020-11-04 17:39:42 +00:00
rtt Add initial RTT support 2020-12-02 23:15:52 +00:00
server Add initial RTT support 2020-12-02 23:15:52 +00:00
svf openocd: fix command's usage string 2020-09-05 17:13:10 +01:00
target arm7_9_common: fix host endianness bug in arm7_9_full_context() 2020-12-05 23:18:29 +00:00
transport build: fix build with --enable-minidriver-dummy 2020-11-07 20:53:39 +00:00
xsvf openocd: avoid checking for non NULL pointer to free it 2020-09-05 17:11:50 +01:00
Makefile.am Add initial RTT support 2020-12-02 23:15:52 +00:00
hello.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
hello.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
main.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
openocd.c Add initial RTT support 2020-12-02 23:15:52 +00:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00