target/armv8: do not mark ELx banked regs 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 of all registers as caller_save = true
GDB inferior call fails in EL2H mode with the message
Could not fetch register "ELR_EL3"; remote failure reply '0E'

It also fails similarly in EL0 and EL1 modes.

A standard function should not change EL banked registers anyway.
Avoid marking ELx banked registers as save-restore.

Treat pauth_dmask and pauth_cmask registers similarly.
They are not typically changed in a function.

Change-Id: Ibaf32210f3fcfa9dfb15e924b888243460e85fb4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9243
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Tomas Vanek
2025-11-19 09:09:23 +01:00
parent ad0ed194f5
commit 7025e3fe3d

View File

@@ -1855,7 +1855,12 @@ struct reg_cache *armv8_build_reg_cache(struct target *target)
reg_list[i].group = armv8_regs[i].group; reg_list[i].group = armv8_regs[i].group;
reg_list[i].number = i; reg_list[i].number = i;
reg_list[i].exist = true; reg_list[i].exist = true;
reg_list[i].caller_save = true; /* gdb defaults to true */
/* Registers which should be preserved across GDB inferior function calls.
* Avoid saving ELx banked registers as a standard function should
* not change them and higher EL registers are not accessible
* in lower EL modes. */
reg_list[i].caller_save = i < ARMV8_ELR_EL1;
feature = calloc(1, sizeof(struct reg_feature)); feature = calloc(1, sizeof(struct reg_feature));
if (feature) { if (feature) {