From: Luis Machado Date: Thu, 1 Oct 2020 04:38:35 +0000 (-0300) Subject: [Morello] Add register aliases for Morello (cfp, clr, c31, cip0 and cip1) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d54450ebb6b34f1089a1d0133c30f10603fd274e;p=thirdparty%2Fbinutils-gdb.git [Morello] Add register aliases for Morello (cfp, clr, c31, cip0 and cip1) This patch adds cfp, clr, c31, cip0 and cip1, aliased to c29, c30, c31, c16 and c17. gdb/ChangeLog: 2020-10-20 Luis Machado * aarch64-tdep.c (aarch64_morello_register_aliases): New static global. (aarch64_gdbarch_init): Initialize alias registers. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d088ccf09a3..301d78fbca3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-10-20 Luis Machado + + * aarch64-tdep.c (aarch64_morello_register_aliases): New static global. + (aarch64_gdbarch_init): Initialize alias registers. + 2020-10-20 Luis Machado * aarch64-linux-tdep.c (aarch64_linux_init_abi): Only set displaced diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index e490fb05116..ddab4c722e6 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -192,6 +192,25 @@ static const struct {"ip1", AARCH64_X0_REGNUM + 17} }; +/* A couple register aliases for Morello. We leave the register numbers + undefined because those are assigned dynamically based on the various + features a particular system supports. + + We need the static storage so we can pass a register number reference to + GDB's hooks. */ +static struct +{ + const char *const name; + int regnum; +} aarch64_morello_register_aliases[] = +{ + {"cip0", -1}, + {"cip1", -1}, + {"cfp", -1}, + {"clr", -1}, + {"c31", -1} +}; + /* The required capability 'C' registers. */ static const char *const aarch64_c_register_names[] = { @@ -3868,6 +3887,23 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pointer_to_address (gdbarch, aarch64_pointer_to_address); set_gdbarch_address_to_pointer (gdbarch, aarch64_address_to_pointer); set_gdbarch_integer_to_address (gdbarch, aarch64_integer_to_address); + + /* Create the Morello register aliases. */ + /* cip0 and cip1 */ + aarch64_morello_register_aliases[0].regnum = tdep->cap_reg_base + 16; + aarch64_morello_register_aliases[1].regnum = tdep->cap_reg_base + 17; + /* cfp */ + aarch64_morello_register_aliases[2].regnum = tdep->cap_reg_base + 29; + /* clr */ + aarch64_morello_register_aliases[3].regnum = tdep->cap_reg_base + 30; + /* c31 */ + aarch64_morello_register_aliases[4].regnum = tdep->cap_reg_base + 31; + + + for (i = 0; i < ARRAY_SIZE (aarch64_morello_register_aliases); i++) + user_reg_add (gdbarch, aarch64_morello_register_aliases[i].name, + value_of_aarch64_user_reg, + &aarch64_morello_register_aliases[i].regnum); } return gdbarch;