riscv-openocd/src/target
Marek Vrbka 1c6b7fa2c9 target: Fix force-reading of registers and add flush capability
1) OpenOCD has the capability to 'force' a register read from the
target. This functionality however silently breaks the register
cache: During 'get_reg force' or 'reg <name> force',
reg->type->get() is called which will silently overwrite
dirty items in the register cache, causing a loss of unwritten
register values. This patch fixes that by adding a flush
callback for registers, and by using it when it is needed.

2) The register write commands did not have the 'force' flag;
this was present for register read commands only.
This patch adds it.

3) This patch also introduces the flush_reg_cache command. It
flushes all registers and can optionally invalidates the register
cache after the flush.

For targets which implement the register cache should implement
the flush() callback in struct reg_arch_type.

This functionality is also useful for test purposes. Example:
 - In RISC-V, some registers are WARL (write any read legal)
   and this command allows to check this behavior.

We plan to implement the corresponding callback
in the RISC-V target.

Change-Id: I9537a5f05b46330f70aad17f77b2b80dedad068a
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-12-20 14:56:56 +03:00
..
espressif target/espressif: add profiling function for ESP32-S3 2024-09-15 09:13:05 +00:00
openrisc target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
riscv target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
xtensa target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
Makefile.am mips32: add per-cpu quirks feature 2023-08-26 11:44:50 +00:00
a64_disassembler.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
a64_disassembler.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
aarch64.c helper/jim-nvp.h: Rework 'isconfigure' variable 2024-11-23 13:48:52 +00:00
aarch64.h aarch64: Use 64-bit reads/writes to access SCTLR_EL1 2023-11-18 11:21:38 +00:00
adi_v5_dapdirect.c jtag: rewrite jim_jtag_configure() as COMMAND_HANDLER 2024-01-13 14:51:22 +00:00
adi_v5_jtag.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
adi_v5_swd.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
algorithm.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
algorithm.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arc.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
arc.h target: arc: rewrite command 'arc add-reg' as COMMAND_HANDLER 2023-02-03 22:48:48 +00:00
arc_cmd.c target: arc: rewrite command 'arc add-reg' as COMMAND_HANDLER 2023-02-03 22:48:48 +00:00
arc_cmd.h openocd: src: fix incorrect SPDX tags 2022-07-23 13:16:09 +00:00
arc_jtag.c fix GCC's `-Wcalloc-transposed-args` warning 2024-06-15 14:11:16 +00:00
arc_jtag.h openocd: src: fix incorrect SPDX tags 2022-07-23 13:16:09 +00:00
arc_mem.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
arc_mem.h openocd: src: fix incorrect SPDX tags 2022-07-23 13:16:09 +00:00
arm.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm7_9_common.c breakpoints: use 64-bit type for watchpoint mask and value 2023-08-08 06:11:01 +00:00
arm7_9_common.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
arm7tdmi.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
arm7tdmi.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arm9tdmi.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm9tdmi.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arm11.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm11.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm11_dbgtap.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm11_dbgtap.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arm720t.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
arm720t.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
arm920t.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
arm920t.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
arm926ejs.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
arm926ejs.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
arm946e.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
arm946e.h target: don't export local symbols 2022-09-13 22:13:58 +00:00
arm966e.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
arm966e.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
arm_adi_v5.c helper/jim-nvp.h: Rework 'isconfigure' variable 2024-11-23 13:48:52 +00:00
arm_adi_v5.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm_coresight.h arm_adi_v5: replace dap_lookup_cs_component() 2022-05-14 08:55:52 +00:00
arm_cti.c helper/jim-nvp.h: Rework 'isconfigure' variable 2024-11-23 13:48:52 +00:00
arm_cti.h arm_cti: Add CTIDEVCTL to register list 2024-08-25 12:40:24 +00:00
arm_dap.c target/arm_adi_v5,arm_dap: introduce pre_connect_init() dap operation 2023-12-29 14:34:50 +00:00
arm_disassembler.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm_disassembler.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm_dpm.c target: arm: drop casts commented-out 2024-10-05 15:49:49 +00:00
arm_dpm.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
arm_jtag.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
arm_jtag.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arm_opcodes.h arm_opcode: Add support for ARM MCRR/MRRC 2023-10-14 11:55:42 +00:00
arm_semihosting.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
arm_semihosting.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arm_simulator.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
arm_simulator.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
arm_tpiu_swo.c helper/jim-nvp.h: Rework 'isconfigure' variable 2024-11-23 13:48:52 +00:00
arm_tpiu_swo.h armv7m_trace: get rid of the old tpiu code 2021-03-10 21:34:04 +00:00
armv4_5.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
armv4_5.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
armv4_5_cache.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
armv4_5_cache.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
armv4_5_mmu.c target: fix messages and return values of failed op because not halted 2023-07-29 05:17:44 +00:00
armv4_5_mmu.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
armv7a.c target: arm: drop casts commented-out 2024-10-05 15:49:49 +00:00
armv7a.h cortex_a: drop the command 'cache auto' 2024-05-11 11:54:40 +00:00
armv7a_cache.c cortex_a: drop the command 'cache auto' 2024-05-11 11:54:40 +00:00
armv7a_cache.h cortex_a: drop the command 'cache auto' 2024-05-11 11:54:40 +00:00
armv7a_cache_l2x.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
armv7a_cache_l2x.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
armv7a_mmu.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
armv7a_mmu.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
armv7m.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
armv7m.h cortex_m: add detection of MVE feature for Armv8.1-M cores 2024-01-29 13:36:27 +03:00
armv7m_trace.c itm: fix default initialization 2024-06-23 09:30:43 +00:00
armv7m_trace.h itm: fix default initialization 2024-06-23 09:30:43 +00:00
armv8.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
armv8.h target: aarch64: drop unused armv8_mmu_translate_va() 2024-11-23 13:47:55 +00:00
armv8_cache.c target: clarify usage of `coreid` 2023-12-01 22:23:13 +00:00
armv8_cache.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
armv8_dpm.c target: arm: drop casts commented-out 2024-10-05 15:49:49 +00:00
armv8_dpm.h openocd: src: replace the incomplete GPL-2.0-or-later license tag 2022-07-23 13:15:24 +00:00
armv8_opcodes.c target/aarch64: add AArch64 mdd and mwd support 2023-09-17 12:07:17 +00:00
armv8_opcodes.h portability fix: Switch binary literals to hex 2024-02-15 09:00:50 +00:00
avr32_ap7k.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
avr32_ap7k.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
avr32_jtag.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
avr32_jtag.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
avr32_mem.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
avr32_mem.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
avr32_regs.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
avr32_regs.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
avrt.c target/avrt: Remove unused parameter 'rti' 2024-08-02 16:04:24 +00:00
avrt.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
breakpoints.c Merge up to 133dd9d669 from upstream 2024-12-18 12:41:19 +03:00
breakpoints.h Merge up to fd7b66c5eb from upstream 2024-09-16 18:38:05 +03:00
cortex_a.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
cortex_a.h target: move parent target structs just after common_magic 2022-08-14 12:10:14 +00:00
cortex_m.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
cortex_m.h target/cortex_m: add DSCSR_CDSKEY bit definition 2024-08-25 12:44:16 +00:00
dsp563xx.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
dsp563xx.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
dsp563xx_once.c target: dsp563xx: make dsp563xx_once_reg_read_ex() static 2024-11-23 13:47:15 +00:00
dsp563xx_once.h target: dsp563xx: make dsp563xx_once_reg_read_ex() static 2024-11-23 13:47:15 +00:00
dsp5680xx.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
dsp5680xx.h target: don't export local symbols 2022-09-13 22:13:58 +00:00
embeddedice.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
embeddedice.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
esirisc.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
esirisc.h target: get_gdb_arch() accepts target via const pointer 2024-01-28 14:18:54 +00:00
esirisc_jtag.c target: esirisc: make local functions static 2024-11-23 13:48:12 +00:00
esirisc_jtag.h target: esirisc: make local functions static 2024-11-23 13:48:12 +00:00
esirisc_regs.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
esirisc_trace.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
esirisc_trace.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
etb.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
etb.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
etm.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
etm.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
etm_dummy.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
etm_dummy.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
fa526.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
feroceon.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
hla_target.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
image.c Merge up to fd62626dff from upstream 2024-11-12 17:25:33 +03:00
image.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
lakemont.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
lakemont.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
ls1_sap.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
mem_ap.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
mips32.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
mips32.h target/mips32: add dsp access support for gdb 2024-10-05 15:43:03 +00:00
mips32_dmaacc.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
mips32_dmaacc.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
mips32_pracc.c OpenOCD: fix code alignment 2024-10-05 15:48:23 +00:00
mips32_pracc.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
mips64.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
mips64.h target: use unsigned int for timeout_ms 2023-05-27 06:41:17 +00:00
mips64_pracc.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
mips64_pracc.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
mips_cpu.h LICENSES: drop SPDX tag 'GPL-2.0' and use 'GPL-2.0-only' 2024-01-29 13:36:27 +03:00
mips_ejtag.c target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
mips_ejtag.h target: convert 'unsigned' to 'unsigned int' 2024-10-05 15:45:34 +00:00
mips_m4k.c target: clarify usage of `coreid` 2023-12-01 22:23:13 +00:00
mips_m4k.h target: don't export local symbols 2022-09-13 22:13:58 +00:00
mips_mips64.c target: use boolean values for 'valid' and 'dirty' flags 2023-11-18 11:16:06 +00:00
mips_mips64.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
quark_d20xx.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
quark_x10xx.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
register.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
register.h target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
rtt.c target: rtt: include rtt.h 2023-05-05 22:14:11 +00:00
rtt.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
semihosting_common.c semihosting: make local functions static 2024-11-23 13:48:25 +00:00
semihosting_common.h semihosting: make local functions static 2024-11-23 13:48:25 +00:00
smp.c smp: fix SIGSEGV for "smp off" during target examine 2024-05-04 08:35:27 +00:00
smp.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
startup.tcl cortex_a: drop the command 'cache auto' 2024-05-11 11:54:40 +00:00
stm8.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
stm8.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00
target.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
target.h Merge up to fd62626dff from upstream 2024-11-12 17:25:33 +03:00
target_request.c cortex_m: fix scan-build false positive 2024-07-28 13:26:05 +00:00
target_request.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
target_type.h target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
testee.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
trace.c openocd: fix SPDX tag format for files .c 2022-09-18 08:22:01 +00:00
trace.h openocd: src/target: replace the GPL-2.0-or-later license tag 2022-07-23 13:58:51 +00:00
x86_32_common.c target: x86_32: make x86_32_common_read_io() static 2024-11-23 13:47:33 +00:00
x86_32_common.h target: x86_32: make x86_32_common_read_io() static 2024-11-23 13:47:33 +00:00
xscale.c target: Fix force-reading of registers and add flush capability 2024-12-20 14:56:56 +03:00
xscale.h target: consolidate existing target/algo common_magic 2022-08-14 12:02:38 +00:00