openocd/src
Antonio Borneo 15dd48119a target/aarch64: fix watchpoint management
The early documentation for armv8a report the debug register WFAR
as containing the address of the instruction that triggered the
watchpoint. More recent documentation report the register EDWAR as
containing the data memory address that triggered the watchpoint.

The name of macros CPUV8_DBG_WFAR0 and CPUV8_DBG_WFAR1 is not
correct as they point to the debug register EDWAR, so reading such
register returns directly the data memory address that triggered
the watchpoint. The code incorrectly passes this address value to
the function armv8_dpm_report_wfar(); this function is supposed to
adjust the PC value, decrementing it to remove the effects of the
CPU pipeline. This pipeline offset, that has no meaning on the
value in EDWAR, caused commit 651b861d5d ("target/aarch64: Add
watchpoint support") to add back the offset while comparing the
address with the watchpoint enabled.

The upper 32 bits of EDWAR are not valid in aarch32 mode and have
to be ignored.

Rename CPUV8_DBG_WFAR0/1 as CPUV8_DBG_EDWAR0/1.
Remove the function armv8_dpm_report_wfar().
Remove the offset while searching the matching watchpoint.
Ignore the upper 32 bits of EDWAR in aarch32 mode.
Fix a comment and the LOG text.

Change-Id: I7cbdbeb766fa18e31cc72be098ca2bc501877ed1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6205
Tested-by: jenkins
Reviewed-by: Liming Sun <limings@nvidia.com>
2021-05-22 10:04:20 +01:00
..
flash flash/nor/xcf: Do not use 'Yoda conditions' 2021-05-11 06:29:47 +01:00
helper jimtcl: restrict memory leak workaround on Linux only 2021-05-15 20:59:36 +01:00
jtag cmsis_dap: fix build on macOS 2021-05-18 17:23:59 +01:00
pld Cleanup of config/includes. 2021-05-01 14:35:09 +01:00
rtos rtos: Add support for Zephyr RTOS 2021-05-11 10:43:22 +01:00
rtt openocd: fix doxygen parameters of functions 2021-01-13 11:33:53 +00:00
server server: gdb_server: Add colon for target extended-remote 2021-05-15 20:57:12 +01:00
svf Cleanup of config/includes. 2021-05-01 14:35:09 +01:00
target target/aarch64: fix watchpoint management 2021-05-22 10:04:20 +01:00
transport Cleanup of config/includes. 2021-05-01 14:35:09 +01:00
xsvf Cleanup of config/includes. 2021-05-01 14:35:09 +01: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 Cleanup of config/includes. 2021-05-01 14:35:09 +01:00
Makefile.am build: Fix out-of-tree with --disable-dependency-tracking configure flag 2021-04-05 23:24:14 +01:00
openocd.c help: re-implement 'help' independent from tree of struct command 2021-04-18 15:33:54 +01:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00