]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[Morello] Add register aliases for Morello (cfp, clr, c31, cip0 and cip1)
authorLuis Machado <luis.machado@arm.com>
Thu, 1 Oct 2020 04:38:35 +0000 (01:38 -0300)
committerLuis Machado <luis.machado@linaro.org>
Tue, 20 Oct 2020 18:06:18 +0000 (15:06 -0300)
This patch adds cfp, clr, c31, cip0 and cip1, aliased to c29, c30, c31, c16 and
c17.

gdb/ChangeLog:

2020-10-20  Luis Machado  <luis.machado@arm.com>

* aarch64-tdep.c (aarch64_morello_register_aliases): New static global.
(aarch64_gdbarch_init): Initialize alias registers.

gdb/ChangeLog
gdb/aarch64-tdep.c

index d088ccf09a3dbee00d1eecca35ea25fd894d8c0d..301d78fbca350a1b59f4d7f5ed02992c92ed5900 100644 (file)
@@ -1,3 +1,8 @@
+2020-10-20  Luis Machado  <luis.machado@arm.com>
+
+       * aarch64-tdep.c (aarch64_morello_register_aliases): New static global.
+       (aarch64_gdbarch_init): Initialize alias registers.
+
 2020-10-20  Luis Machado  <luis.machado@arm.com>
 
        * aarch64-linux-tdep.c (aarch64_linux_init_abi): Only set displaced
index e490fb051168b41dac9f20f3aab84750d67f0bfc..ddab4c722e69d896eee421d504afa00a4d55a7b9 100644 (file)
@@ -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;