|
From: openocd-gerrit <ope...@us...> - 2025-11-19 17:57:15
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 5d8a142703e9c6871e5fe6ab3bdf348561d215a5 (commit)
via d044affba5b0f6c0f5d866f7f2022663ba32a596 (commit)
from 83052c86e9f593a9951135182f54730f792531d0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5d8a142703e9c6871e5fe6ab3bdf348561d215a5
Author: Tomas Vanek <va...@fb...>
Date: Mon Nov 3 08:50:32 2025 +0100
target/armv4_5: mark registers as 'save-restore'
gdb uses this mark when creating a dummy frame for
manual call of a function by gdb command.
With the original setting all registers as caller_save = false
call command in gdb always clobbers r0, r1 and pc
and some other registers depending on the called function.
Set 'save-restore' for all registers but banked ones.
Change-Id: I16c49e4bf8001e38d18ce8861ca65988b08ccc88
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9208
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index e1a46bad3..1b3ca0cdb 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -691,8 +691,6 @@ struct reg_cache *arm_build_reg_cache(struct target *target, struct arm *arm)
&& arm->core_type != ARM_CORE_TYPE_VIRT_EXT)
continue;
- /* REVISIT handle Cortex-M, which only shadows R13/SP */
-
reg_arch_info[i].num = arm_core_regs[i].cookie;
reg_arch_info[i].mode = arm_core_regs[i].mode;
reg_arch_info[i].target = target;
@@ -706,9 +704,6 @@ struct reg_cache *arm_build_reg_cache(struct target *target, struct arm *arm)
reg_list[i].arch_info = ®_arch_info[i];
reg_list[i].exist = true;
- /* This really depends on the calling convention in use */
- reg_list[i].caller_save = false;
-
/* Registers data type, as used by GDB target description */
reg_list[i].reg_data_type = malloc(sizeof(struct reg_data_type));
switch (arm_core_regs[i].cookie) {
@@ -729,9 +724,16 @@ struct reg_cache *arm_build_reg_cache(struct target *target, struct arm *arm)
if (reg_list[i].number <= 15 || reg_list[i].number == 25) {
reg_list[i].feature->name = "org.gnu.gdb.arm.core";
reg_list[i].group = "general";
+ /* Registers which should be preserved across GDB inferior function calls.
+ * Avoid saving banked registers as GDB (version 16.2 in time of writing)
+ * does not take the current mode into account and messes the value
+ * by restoring both the not banked register and the banked alias of it
+ * in the current mode. */
+ reg_list[i].caller_save = true;
} else {
reg_list[i].feature->name = "net.sourceforge.openocd.banked";
reg_list[i].group = "banked";
+ reg_list[i].caller_save = false;
}
cache->num_regs++;
@@ -751,7 +753,8 @@ struct reg_cache *arm_build_reg_cache(struct target *target, struct arm *arm)
reg_list[i].arch_info = ®_arch_info[i];
reg_list[i].exist = true;
- reg_list[i].caller_save = false;
+ /* Mark d0 - d31 and fpscr as save-restore for GDB */
+ reg_list[i].caller_save = true;
reg_list[i].reg_data_type = malloc(sizeof(struct reg_data_type));
reg_list[i].reg_data_type->type = arm_vfp_v3_regs[j].type;
commit d044affba5b0f6c0f5d866f7f2022663ba32a596
Author: Tomas Vanek <va...@fb...>
Date: Mon Nov 10 19:30:44 2025 +0100
target/armv4_5: fix register numbering overlap
Commit b5d2b1224fed ("target/cortex_a: add hypervisor mode")
added sp_hyp, spsr_hyp registers with gdb_index 51 and 52
but did not moved FP regs enum base starting from 51.
Move FP registers indices to make room for added registers.
Change-Id: I4338777545918fdf62016e06764308dacea61e98
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9235
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/arm.h b/src/target/arm.h
index 79ec99d11..54a25731c 100644
--- a/src/target/arm.h
+++ b/src/target/arm.h
@@ -108,7 +108,8 @@ enum arm_mode {
/* VFPv3 internal register numbers mapping to d0:31 */
enum {
- ARM_VFP_V3_D0 = 51,
+ ARM_VFP_V3_D0 = 53,
+ // numbering should not overlap with e.g. armv4_5.c arm_core_regs .gdb_index
ARM_VFP_V3_D1,
ARM_VFP_V3_D2,
ARM_VFP_V3_D3,
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index d1a81614e..e1a46bad3 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -355,6 +355,7 @@ static const struct {
/* These exist only when the Virtualization Extensions is present */
[42] = { .name = "sp_hyp", .cookie = 13, .mode = ARM_MODE_HYP, .gdb_index = 51, },
[43] = { .name = "spsr_hyp", .cookie = 16, .mode = ARM_MODE_HYP, .gdb_index = 52, },
+ // .gdb_index numbering continues by ARM_VFP_V3_D0
};
static const struct {
-----------------------------------------------------------------------
Summary of changes:
src/target/arm.h | 3 ++-
src/target/armv4_5.c | 16 ++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|