[PowerPC] Consolidate linux vector regset sizes
authorPedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)
committerPedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
Tue, 22 May 2018 14:52:02 +0000 (11:52 -0300)
This patch defines constants for the sizes of the two vector
regsets (vector-scalar registers and regular vector registers).

The native, gdbserver and core file targets are changed to use these
constants.

The Linux ptrace calls return (or read) a smaller regset than the one
found in core files for vector registers, because ptrace uses a single
4-byte quantity for vrsave at the end of the regset, while the
core-file regset uses a full 16-byte field for vrsave. For simplicity,
the larger size is used in both cases, and so a buffer with 12 unused
additional bytes is passed to ptrace in the native target.

gdb/ChangeLog:
2018-05-22  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>

* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_VRREGSET)
(PPC_LINUX_SIZEOF_VSXREGSET): Define.
* ppc-linux-nat.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
(gdb_vrregset_t): Change array type size to
PPC_LINUX_SIZEOF_VRREGSET.
(gdb_vsxregset_t): Change array type size to
PPC_LINUX_SIZEOF_VSXREGSET.
* ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections):
Change integer literals to PPC_LINUX_SIZEOF_VRREGSET and
PPC_LINUX_SIZEOF_VSXREGSET.

gdb/gdbserver/ChangeLog:
2018-05-22  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>

* linux-ppc-low.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
(ppc_arch_setup): Change SIZEOF_VRREGS and SIZEOF_VSXREGS to
PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET.

gdb/ChangeLog
gdb/arch/ppc-linux-common.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-ppc-low.c
gdb/ppc-linux-nat.c
gdb/ppc-linux-tdep.c

index 7e9b9b27d5d7f08ce274a7cfe2446ce2e52b7ea7..d99f5c078a5bec149afcb7d23eb11d6cc827b37a 100644 (file)
@@ -1,3 +1,16 @@
+2018-05-22  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>
+
+       * arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_VRREGSET)
+       (PPC_LINUX_SIZEOF_VSXREGSET): Define.
+       * ppc-linux-nat.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
+       (gdb_vrregset_t): Change array type size to
+       PPC_LINUX_SIZEOF_VRREGSET.
+       (gdb_vsxregset_t): Change array type size to
+       PPC_LINUX_SIZEOF_VSXREGSET.
+       * ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections):
+       Change integer literals to PPC_LINUX_SIZEOF_VRREGSET and
+       PPC_LINUX_SIZEOF_VSXREGSET.
+
 2018-05-22  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>
 
        * configure.nat <linux powerpc>: Add ppc-linux.o to NATDEPFILES.
index b82adc49d208f62955c061c8ffaeeec5ff6c7d57..798781cbf7fdd58a87f244ff73ce8a192a99d03a 100644 (file)
 
 struct target_desc;
 
+/* The core file VMX regset has 34 16-byte fields (32 16-byte vector
+   registers, plus two fields containing 4-byte registers, VSCR and
+   VRSAVE), while the ptrace calls return or read 33 16-byte fields
+   plus a 4-byte field for VRSAVE. For simplicity we use the longer
+   length for both cases.  */
+#define PPC_LINUX_SIZEOF_VRREGSET 544
+
+#define PPC_LINUX_SIZEOF_VSXREGSET 256
+
 /* Check if the hwcap auxv entry indicates that isa205 is supported.  */
 bool ppc_linux_has_isa205 (unsigned long hwcap);
 
index 9149c2faa322d1287f21040c69547c8e80469506..1efddc44a159a51be4bb471f2d1e18de0ff23864 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-22  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>
+
+       * linux-ppc-low.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
+       (ppc_arch_setup): Change SIZEOF_VRREGS and SIZEOF_VSXREGS to
+       PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET.
+
 2018-05-22  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>
 
        * linux-ppc-low.c (ppc_fill_vsxregset): Remove ppc_hwcap check.
index b440b0e0a7339a1da368678a0702d4d535fbad7a..367851836e4e90227e0f921d2e0bddfcc066ed14 100644 (file)
@@ -459,8 +459,6 @@ static void ppc_fill_gregset (struct regcache *regcache, void *buf)
     ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]);
 }
 
-#define SIZEOF_VSXREGS 32*8
-
 static void
 ppc_fill_vsxregset (struct regcache *regcache, void *buf)
 {
@@ -483,8 +481,6 @@ ppc_store_vsxregset (struct regcache *regcache, const void *buf)
     supply_register (regcache, base + i, &regset[i * 8]);
 }
 
-#define SIZEOF_VRREGS 33*16+4
-
 static void
 ppc_fill_vrregset (struct regcache *regcache, void *buf)
 {
@@ -660,10 +656,10 @@ ppc_arch_setup (void)
     switch (regset->get_request)
       {
       case PTRACE_GETVRREGS:
-       regset->size = features.altivec ? SIZEOF_VRREGS : 0;
+       regset->size = features.altivec ? PPC_LINUX_SIZEOF_VRREGSET : 0;
        break;
       case PTRACE_GETVSXREGS:
-       regset->size = features.vsx ? SIZEOF_VSXREGS : 0;
+       regset->size = features.vsx ? PPC_LINUX_SIZEOF_VSXREGSET : 0;
        break;
       case PTRACE_GETEVRREGS:
        if (ppc_hwcap & PPC_FEATURE_HAS_SPE)
index 7e96032d4c028bc78abe9a90e217b0ff5e4fa780..a8f202dd33531da56eb3d3e27f7e2f8f27709dd6 100644 (file)
@@ -174,9 +174,7 @@ struct ppc_hw_breakpoint
 */
 /* *INDENT-ON* */
 
-#define SIZEOF_VRREGS 33*16+4
-
-typedef char gdb_vrregset_t[SIZEOF_VRREGS];
+typedef char gdb_vrregset_t[PPC_LINUX_SIZEOF_VRREGSET];
 
 /* This is the layout of the POWER7 VSX registers and the way they overlap
    with the existing FPR and VMX registers.
@@ -210,9 +208,7 @@ typedef char gdb_vrregset_t[SIZEOF_VRREGS];
    the FP registers (doubleword 0) and hence extend them with additional
    64 bits (doubleword 1).  The other 32 regs overlap with the VMX
    registers.  */
-#define SIZEOF_VSXREGS 32*8
-
-typedef char gdb_vsxregset_t[SIZEOF_VSXREGS];
+typedef char gdb_vsxregset_t[PPC_LINUX_SIZEOF_VSXREGSET];
 
 /* On PPC processors that support the Signal Processing Extension
    (SPE) APU, the general-purpose registers are 64 bits long.
index 1d3b019c3080a886826b0abcc70b3b44eab09684..344069d752e3e241299505c3beb016ded11135c4 100644 (file)
@@ -557,10 +557,12 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
   cb (".reg2", 264, &ppc32_linux_fpregset, NULL, cb_data);
 
   if (have_altivec)
-    cb (".reg-ppc-vmx", 544, &ppc32_linux_vrregset, "ppc Altivec", cb_data);
+    cb (".reg-ppc-vmx", PPC_LINUX_SIZEOF_VRREGSET, &ppc32_linux_vrregset,
+       "ppc Altivec", cb_data);
 
   if (have_vsx)
-    cb (".reg-ppc-vsx", 256, &ppc32_linux_vsxregset, "POWER7 VSX", cb_data);
+    cb (".reg-ppc-vsx", PPC_LINUX_SIZEOF_VSXREGSET,
+       &ppc32_linux_vsxregset, "POWER7 VSX", cb_data);
 }
 
 static void
This page took 0.038264 seconds and 4 git commands to generate.