]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[Morello] Add preliminary core file register set support
authorLuis Machado <luis.machado@arm.com>
Mon, 19 Oct 2020 21:46:49 +0000 (18:46 -0300)
committerLuis Machado <luis.machado@linaro.org>
Tue, 20 Oct 2020 18:06:56 +0000 (15:06 -0300)
Add the register set that is going to be used to read core file data.

gdb/ChangeLog:

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

* aarch64-linux-tdep.c (aarch64_linux_cregmap)
(aarch64_linux_cregset): New structs.
(aarch64_linux_iterate_over_regset_sections): Check for capability
registers.
(aarch64_linux_init_abi): Initialize C register set numbers.

gdb/ChangeLog
gdb/aarch64-linux-tdep.c

index 00788bb0dcb5e4b24a124f0a84d65a4848062197..ea5db55410d52a78a7563c121bfbd5fd32070f0a 100644 (file)
@@ -1,3 +1,11 @@
+2020-10-20  Luis Machado  <luis.machado@arm.com>
+
+       * aarch64-linux-tdep.c (aarch64_linux_cregmap)
+       (aarch64_linux_cregset): New structs.
+       (aarch64_linux_iterate_over_regset_sections): Check for capability
+       registers.
+       (aarch64_linux_init_abi): Initialize C register set numbers.
+
 2020-10-20  Luis Machado  <luis.machado@arm.com>
 
        * aarch64-tdep.c (aarch64_analyze_prologue): Handle C registers and
index 70b2224a0f016ad540f950511fd8b6f4fbc33613..398b429341d8c17c48551e11a63ff5faade566b5 100644 (file)
@@ -474,6 +474,20 @@ static const struct regcache_map_entry aarch64_linux_fpregmap[] =
     { 0 }
   };
 
+/* Since the C register numbers are determined dynamically, we leave
+   placeholders so we can update the numbers later.  */
+static struct regcache_map_entry aarch64_linux_cregmap[] =
+  {
+    /* FIXME-Morello: Need to decide if we are reading the whole 16 bytes or
+       just the upper 8 bytes of the capability registers.  */
+    { 31, -1, 8 }, /* c0 ... c30 */
+    { 1, -1, 8 }, /* Stack Pointer Capability */
+    { 1, -1, 8 }, /* Program Counter Capability */
+    { 1, -1, 16 }, /* Default Data Capability */
+    { 1, -1, 8 },
+    { 0 }
+  };
+
 /* Register set definitions.  */
 
 const struct regset aarch64_linux_gregset =
@@ -488,6 +502,13 @@ const struct regset aarch64_linux_fpregset =
     regcache_supply_regset, regcache_collect_regset
   };
 
+/* The capability register set.  */
+const struct regset aarch64_linux_cregset =
+  {
+    aarch64_linux_cregmap,
+    regcache_supply_regset, regcache_collect_regset
+  };
+
 /* The fields in an SVE header at the start of a SVE regset.  */
 
 #define SVE_HEADER_SIZE_LENGTH         4
@@ -723,6 +744,15 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
          AARCH64_LINUX_SIZEOF_PAUTH, &aarch64_linux_pauth_regset,
          "pauth registers", cb_data);
     }
+
+  /* FIXME-Morello: We still need to provide a valid check for the presence of
+     capability registers.  */
+  if (tdep->has_capability ())
+    {
+      cb (".reg-cap", AARCH64_LINUX_CREGS_SIZE,
+         AARCH64_LINUX_CREGS_SIZE, &aarch64_linux_cregset,
+         NULL, cb_data);
+    }
 }
 
 /* Implement the "core_read_description" gdbarch method.  */
@@ -1815,6 +1845,13 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   if (tdep->has_capability ())
     {
+      /* Initialize the register numbers for the core file register set.  */
+      /* FIXME-Morello: This needs to be updated.  */
+      aarch64_linux_cregmap[0].regno = tdep->cap_reg_base;
+      aarch64_linux_cregmap[1].regno = tdep->cap_reg_base + 32;
+      aarch64_linux_cregmap[2].regno = tdep->cap_reg_base + 31;
+      aarch64_linux_cregmap[3].regno = tdep->cap_reg_base + 33;
+
       set_gdbarch_report_signal_info (gdbarch,
                                      aarch64_linux_report_signal_info);
     }