Blame SOURCES/gdb-rhbz1187581-power8-regs-not-in-8-2-10of15.patch

ce65b8
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
ce65b8
From: Keith Seitz <keiths@redhat.com>
ce65b8
Date: Fri, 11 Jan 2019 17:02:16 -0500
ce65b8
Subject: gdb-rhbz1187581-power8-regs-not-in-8-2-10of15.patch
ce65b8
ce65b8
;; [PowerPC] Add support for PPR and DSCR
ce65b8
;; Edjunior Barbosa Machado and Pedro Franco de Carvalho
ce65b8
ce65b8
    [PowerPC] Add support for PPR and DSCR
ce65b8
ce65b8
    This patch adds gdb support for the Program Priorty Register and the
ce65b8
    Data Stream Control Register, for the powerpc linux native and core
ce65b8
    file targets, and for the powerpc linux server stub.
ce65b8
ce65b8
    gdb/ChangeLog:
ce65b8
    2018-10-26  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
ce65b8
            Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
ce65b8
ce65b8
        * arch/ppc-linux-tdesc.h (tdesc_powerpc_isa205_ppr_dscr_vsx32l)
ce65b8
        (tdesc_powerpc_isa205_ppr_dscr_vsx64l): Declare.
ce65b8
        * arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_PPRREGSET)
ce65b8
        (PPC_LINUX_SIZEOF_DSCRREGSET): Define.
ce65b8
        (struct ppc_linux_features) <ppr_dscr>: New field.
ce65b8
        (ppc_linux_no_features): Add initializer for ppr_dscr field.
ce65b8
        * arch/ppc-linux-common.c (ppc_linux_match_description): Return
ce65b8
        new tdescs.
ce65b8
        * nat/ppc-linux.h (PPC_FEATURE2_DSCR, NT_PPC_PPR, NT_PPC_DSCR):
ce65b8
        Define if not already defined.
ce65b8
        * features/Makefile (WHICH): Add
ce65b8
        rs6000/powerpc-isa205-ppr-dscr-vsx32l and
ce65b8
        rs6000/powerpc-isa205-ppr-dscr-vsx64l.
ce65b8
        (XMLTOC): Add rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml and
ce65b8
        rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml.
ce65b8
        * features/rs6000/power-dscr.xml: New file.
ce65b8
        * features/rs6000/power-ppr.xml: New file.
ce65b8
        * features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml: New file.
ce65b8
        * features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml: New file.
ce65b8
        * features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c: Generate.
ce65b8
        * features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c: Generate.
ce65b8
        * regformats/rs6000/powerpc-isa205-ppr-dscr-vsx32l.dat: Generate.
ce65b8
        * regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat: Generate.
ce65b8
        * ppc-linux-nat.c: Include <sys/uio.h>.
ce65b8
        (fetch_regset, store_regset, check_regset): New functions.
ce65b8
        (fetch_register, fetch_ppc_registers): Call fetch_regset with
ce65b8
        DSCR and PPR regsets.
ce65b8
        (store_register, store_ppc_registers): Call store_regset with
ce65b8
        DSCR and PPR regsets.
ce65b8
        (ppc_linux_get_hwcap2): New function.
ce65b8
        (ppc_linux_nat_target::read_description): Call
ce65b8
        ppc_linux_get_hwcap2 and check_regset, set ppr_dscr field in the
ce65b8
        features struct if needed.
ce65b8
        * ppc-linux-tdep.c: Include
ce65b8
        features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c and
ce65b8
        features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c.
ce65b8
        (ppc32_regmap_ppr, ppc32_regmap_dscr, ppc32_linux_pprregset)
ce65b8
        (ppc32_linux_dscrregset): New globals.
ce65b8
        (ppc_linux_iterate_over_regset_sections): Call back with the ppr
ce65b8
        and dscr regsets.
ce65b8
        (ppc_linux_core_read_description): Check if the ppr and dscr
ce65b8
        sections are present and set ppr_dscr in the features struct.
ce65b8
        (_initialize_ppc_linux_tdep): Call
ce65b8
        initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l and
ce65b8
        initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l.
ce65b8
        * ppc-linux-tdep.h (ppc32_linux_pprregset)
ce65b8
        (ppc32_linux_dscrregset): Declare.
ce65b8
        * ppc-tdep.h (struct gdbarch_tdep) <ppc_ppr_regnum>: New field.
ce65b8
        <ppc_dscr_regnum>: New field.
ce65b8
        (enum) <PPC_PPR_REGNUM, PPC_DSCR_REGNUM>: New enum values.
ce65b8
        * rs6000-tdep.c (rs6000_gdbarch_init): Look for and validate ppr
ce65b8
        and dscr features.
ce65b8
        (ppc_process_record_op31): Record changes to PPR and DSCR.
ce65b8
ce65b8
    gdb/gdbserver/ChangeLog:
ce65b8
    2018-10-26  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
ce65b8
            Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
ce65b8
ce65b8
        * configure.srv (ipa_ppc_linux_regobj): Add
ce65b8
        powerpc-isa205-ppr-dscr-vsx32l-ipa.o and
ce65b8
        powerpc-isa205-ppr-dscr-vsx64l-ipa.o.
ce65b8
        (powerpc*-*-linux*): Add powerpc-isa205-ppr-dscr-vsx32l.o and
ce65b8
        powerpc-isa205-ppr-dscr-vsx64l.o to srv_regobj, add
ce65b8
        rs6000/power-dscr.xml, rs6000/power-ppr.xml,
ce65b8
        rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml and
ce65b8
        rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml to srv_xmlfiles.
ce65b8
        * linux-ppc-tdesc-init.h (enum ppc_linux_tdesc)
ce65b8
        <PPC_TDESC_ISA205_PPR_DSCR_VSX>: New enum value.
ce65b8
        (init_registers_powerpc_isa205_ppr_dscr_vsx32l)
ce65b8
        (init_registers_powerpc_isa205_ppr_dscr_vsx64l): Declare.
ce65b8
        * linux-ppc-low.c: Include "elf/common.h" and <sys/uio.h>.
ce65b8
        (ppc_hwcap): Add comment.
ce65b8
        (ppc_hwcap2): New global.
ce65b8
        (ppc_check_regset, ppc_fill_pprregset, ppc_store_pprregset)
ce65b8
        (ppc_fill_dscrregset, ppc_store_dscrregset): New functions.
ce65b8
        (ppc_regsets): Add entries for the DSCR and PPR regsets.
ce65b8
        (ppc_arch_setup): Get AT_HWCAP2.  Set ppr_dscr in features struct
ce65b8
        when needed.  Set sizes for the the DSCR and PPR regsets.
ce65b8
        (ppc_get_ipa_tdesc_idx): Return PPC_TDESC_ISA205_PPR_DSCR_VSX.
ce65b8
        (initialize_low_arch): Call
ce65b8
        init_registers_powerpc_isa205_ppr_dscr_vsx32l and
ce65b8
        init_registers_powerpc_isa205_ppr_dscr_vsx64l.
ce65b8
        * linux-ppc-ipa.c (get_ipa_tdesc): Handle
ce65b8
        PPC_TDESC_ISA205_PPR_DSCR_VSX.
ce65b8
        (initialize_low_tracepoint): Call
ce65b8
        init_registers_powerpc_isa205_ppr_dscr_vsx32l and
ce65b8
        init_registers_powerpc_isa205_ppr_dscr_vsx64l.
ce65b8
ce65b8
    gdb/testsuite/ChangeLog:
ce65b8
    2018-10-26  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
ce65b8
ce65b8
        * gdb.arch/powerpc-ppr-dscr.c: New file.
ce65b8
        * gdb.arch/powerpc-ppr-dscr.exp: New file.
ce65b8
ce65b8
    gdb/doc/ChangeLog:
ce65b8
    2018-10-26  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
ce65b8
ce65b8
        * gdb.texinfo (PowerPC Features): Describe new features
ce65b8
        "org.gnu.gdb.power.ppr" and "org.gnu.gdb.power.dscr".
ce65b8
ce65b8
diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c
ce65b8
--- a/gdb/arch/ppc-linux-common.c
ce65b8
+++ b/gdb/arch/ppc-linux-common.c
ce65b8
@@ -53,7 +53,8 @@ ppc_linux_match_description (struct ppc_linux_features features)
ce65b8
       if (features.cell)
ce65b8
 	tdesc = tdesc_powerpc_cell64l;
ce65b8
       else if (features.vsx)
ce65b8
-	tdesc = (features.isa205? tdesc_powerpc_isa205_vsx64l
ce65b8
+	tdesc = (features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l
ce65b8
+		 : features.isa205? tdesc_powerpc_isa205_vsx64l
ce65b8
 		 : tdesc_powerpc_vsx64l);
ce65b8
       else if (features.altivec)
ce65b8
 	tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l
ce65b8
@@ -69,7 +70,8 @@ ppc_linux_match_description (struct ppc_linux_features features)
ce65b8
       if (features.cell)
ce65b8
 	tdesc = tdesc_powerpc_cell32l;
ce65b8
       else if (features.vsx)
ce65b8
-	tdesc = (features.isa205? tdesc_powerpc_isa205_vsx32l
ce65b8
+	tdesc = (features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l
ce65b8
+		 : features.isa205? tdesc_powerpc_isa205_vsx32l
ce65b8
 		 : tdesc_powerpc_vsx32l);
ce65b8
       else if (features.altivec)
ce65b8
 	tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l
ce65b8
diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h
ce65b8
--- a/gdb/arch/ppc-linux-common.h
ce65b8
+++ b/gdb/arch/ppc-linux-common.h
ce65b8
@@ -30,6 +30,8 @@ struct target_desc;
ce65b8
 #define PPC_LINUX_SIZEOF_VRREGSET 544
ce65b8
 
ce65b8
 #define PPC_LINUX_SIZEOF_VSXREGSET 256
ce65b8
+#define PPC_LINUX_SIZEOF_PPRREGSET 8
ce65b8
+#define PPC_LINUX_SIZEOF_DSCRREGSET 8
ce65b8
 
ce65b8
 /* Check if the hwcap auxv entry indicates that isa205 is supported.  */
ce65b8
 bool ppc_linux_has_isa205 (CORE_ADDR hwcap);
ce65b8
@@ -41,6 +43,7 @@ struct ppc_linux_features
ce65b8
   bool altivec;
ce65b8
   bool vsx;
ce65b8
   bool isa205;
ce65b8
+  bool ppr_dscr;
ce65b8
   bool cell;
ce65b8
 };
ce65b8
 
ce65b8
@@ -51,6 +54,7 @@ const struct ppc_linux_features ppc_linux_no_features = {
ce65b8
   false,
ce65b8
   false,
ce65b8
   false,
ce65b8
+  false,
ce65b8
 };
ce65b8
 
ce65b8
 /* Return a target description that matches FEATURES.  */
ce65b8
diff --git a/gdb/arch/ppc-linux-tdesc.h b/gdb/arch/ppc-linux-tdesc.h
ce65b8
--- a/gdb/arch/ppc-linux-tdesc.h
ce65b8
+++ b/gdb/arch/ppc-linux-tdesc.h
ce65b8
@@ -29,6 +29,7 @@ extern struct target_desc *tdesc_powerpc_vsx32l;
ce65b8
 extern struct target_desc *tdesc_powerpc_isa205_32l;
ce65b8
 extern struct target_desc *tdesc_powerpc_isa205_altivec32l;
ce65b8
 extern struct target_desc *tdesc_powerpc_isa205_vsx32l;
ce65b8
+extern struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
ce65b8
 extern struct target_desc *tdesc_powerpc_e500l;
ce65b8
 
ce65b8
 extern struct target_desc *tdesc_powerpc_64l;
ce65b8
@@ -38,5 +39,6 @@ extern struct target_desc *tdesc_powerpc_vsx64l;
ce65b8
 extern struct target_desc *tdesc_powerpc_isa205_64l;
ce65b8
 extern struct target_desc *tdesc_powerpc_isa205_altivec64l;
ce65b8
 extern struct target_desc *tdesc_powerpc_isa205_vsx64l;
ce65b8
+extern struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
ce65b8
 
ce65b8
 #endif /* ARCH_PPC_LINUX_TDESC_H */
ce65b8
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
ce65b8
--- a/gdb/doc/gdb.texinfo
ce65b8
+++ b/gdb/doc/gdb.texinfo
ce65b8
@@ -42576,6 +42576,12 @@ contain registers @samp{ev0h} through @samp{ev31h}, @samp{acc}, and
ce65b8
 these to present registers @samp{ev0} through @samp{ev31} to the
ce65b8
 user.
ce65b8
 
ce65b8
+The @samp{org.gnu.gdb.power.ppr} feature is optional.  It should
ce65b8
+contain the 64-bit register @samp{ppr}.
ce65b8
+
ce65b8
+The @samp{org.gnu.gdb.power.dscr} feature is optional.  It should
ce65b8
+contain the 64-bit register @samp{dscr}.
ce65b8
+
ce65b8
 @node S/390 and System z Features
ce65b8
 @subsection S/390 and System z Features
ce65b8
 @cindex target descriptions, S/390 features
ce65b8
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
ce65b8
--- a/gdb/features/Makefile
ce65b8
+++ b/gdb/features/Makefile
ce65b8
@@ -73,6 +73,8 @@ WHICH = aarch64 \
ce65b8
 	rs6000/powerpc-isa205-32l rs6000/powerpc-isa205-64l \
ce65b8
 	rs6000/powerpc-isa205-altivec32l rs6000/powerpc-isa205-altivec64l \
ce65b8
 	rs6000/powerpc-isa205-vsx32l rs6000/powerpc-isa205-vsx64l \
ce65b8
+	rs6000/powerpc-isa205-ppr-dscr-vsx32l \
ce65b8
+	rs6000/powerpc-isa205-ppr-dscr-vsx64l \
ce65b8
 	s390-linux32 s390-linux64 s390x-linux64 \
ce65b8
 	s390-linux32v1 s390-linux64v1 s390x-linux64v1 \
ce65b8
 	s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
ce65b8
@@ -167,6 +169,8 @@ XMLTOC = \
ce65b8
 	rs6000/powerpc-isa205-altivec64l.xml \
ce65b8
 	rs6000/powerpc-isa205-vsx32l.xml \
ce65b8
 	rs6000/powerpc-isa205-vsx64l.xml \
ce65b8
+	rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml \
ce65b8
+	rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml \
ce65b8
 	rs6000/powerpc-vsx32.xml \
ce65b8
 	rs6000/powerpc-vsx32l.xml \
ce65b8
 	rs6000/powerpc-vsx64.xml \
ce65b8
diff --git a/gdb/features/rs6000/power-dscr.xml b/gdb/features/rs6000/power-dscr.xml
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/features/rs6000/power-dscr.xml
ce65b8
@@ -0,0 +1,12 @@
ce65b8
+
ce65b8
+
ce65b8
+
ce65b8
+     Copying and distribution of this file, with or without modification,
ce65b8
+     are permitted in any medium without royalty provided the copyright
ce65b8
+     notice and this notice are preserved.  -->
ce65b8
+
ce65b8
+
ce65b8
+
ce65b8
+<feature name="org.gnu.gdb.power.dscr">
ce65b8
+  <reg name="dscr" bitsize="64" type="uint64"/>
ce65b8
+</feature>
ce65b8
diff --git a/gdb/features/rs6000/power-ppr.xml b/gdb/features/rs6000/power-ppr.xml
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/features/rs6000/power-ppr.xml
ce65b8
@@ -0,0 +1,12 @@
ce65b8
+
ce65b8
+
ce65b8
+
ce65b8
+     Copying and distribution of this file, with or without modification,
ce65b8
+     are permitted in any medium without royalty provided the copyright
ce65b8
+     notice and this notice are preserved.  -->
ce65b8
+
ce65b8
+
ce65b8
+
ce65b8
+<feature name="org.gnu.gdb.power.ppr">
ce65b8
+  <reg name="ppr" bitsize="64" type="uint64"/>
ce65b8
+</feature>
ce65b8
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c
ce65b8
@@ -0,0 +1,200 @@
ce65b8
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
ce65b8
+  Original: powerpc-isa205-ppr-dscr-vsx32l.xml */
ce65b8
+
ce65b8
+#include "defs.h"
ce65b8
+#include "osabi.h"
ce65b8
+#include "target-descriptions.h"
ce65b8
+
ce65b8
+struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
ce65b8
+static void
ce65b8
+initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l (void)
ce65b8
+{
ce65b8
+  struct target_desc *result = allocate_target_description ();
ce65b8
+  set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
ce65b8
+
ce65b8
+  struct tdesc_feature *feature;
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
ce65b8
+  tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "pc", 64, 1, NULL, 32, "code_ptr");
ce65b8
+  tdesc_create_reg (feature, "msr", 65, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "lr", 67, 1, NULL, 32, "code_ptr");
ce65b8
+  tdesc_create_reg (feature, "ctr", 68, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu");
ce65b8
+  tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "fpscr", 70, 1, "float", 64, "int");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux");
ce65b8
+  tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int");
ce65b8
+  tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
ce65b8
+  tdesc_type *element_type;
ce65b8
+  element_type = tdesc_named_type (feature, "ieee_single");
ce65b8
+  tdesc_create_vector (feature, "v4f", element_type, 4);
ce65b8
+
ce65b8
+  element_type = tdesc_named_type (feature, "int32");
ce65b8
+  tdesc_create_vector (feature, "v4i32", element_type, 4);
ce65b8
+
ce65b8
+  element_type = tdesc_named_type (feature, "int16");
ce65b8
+  tdesc_create_vector (feature, "v8i16", element_type, 8);
ce65b8
+
ce65b8
+  element_type = tdesc_named_type (feature, "int8");
ce65b8
+  tdesc_create_vector (feature, "v16i8", element_type, 16);
ce65b8
+
ce65b8
+  tdesc_type_with_fields *type_with_fields;
ce65b8
+  type_with_fields = tdesc_create_union (feature, "vec128");
ce65b8
+  tdesc_type *field_type;
ce65b8
+  field_type = tdesc_named_type (feature, "uint128");
ce65b8
+  tdesc_add_field (type_with_fields, "uint128", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v4f");
ce65b8
+  tdesc_add_field (type_with_fields, "v4_float", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v4i32");
ce65b8
+  tdesc_add_field (type_with_fields, "v4_int32", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v8i16");
ce65b8
+  tdesc_add_field (type_with_fields, "v8_int16", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v16i8");
ce65b8
+  tdesc_add_field (type_with_fields, "v16_int8", field_type);
ce65b8
+
ce65b8
+  tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int");
ce65b8
+  tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.vsx");
ce65b8
+  tdesc_create_reg (feature, "vs0h", 107, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs1h", 108, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs2h", 109, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs3h", 110, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs4h", 111, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs5h", 112, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs6h", 113, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs7h", 114, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs8h", 115, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs9h", 116, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs10h", 117, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs11h", 118, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs12h", 119, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs13h", 120, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs14h", 121, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs15h", 122, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs16h", 123, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs17h", 124, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs18h", 125, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs19h", 126, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs20h", 127, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs21h", 128, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs22h", 129, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs23h", 130, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs24h", 131, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs25h", 132, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs26h", 133, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs27h", 134, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs28h", 135, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs29h", 136, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs30h", 137, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.ppr");
ce65b8
+  tdesc_create_reg (feature, "ppr", 139, 1, NULL, 64, "uint64");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.dscr");
ce65b8
+  tdesc_create_reg (feature, "dscr", 140, 1, NULL, 64, "uint64");
ce65b8
+
ce65b8
+  tdesc_powerpc_isa205_ppr_dscr_vsx32l = result;
ce65b8
+}
ce65b8
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml
ce65b8
@@ -0,0 +1,18 @@
ce65b8
+
ce65b8
+
ce65b8
+
ce65b8
+     Copying and distribution of this file, with or without modification,
ce65b8
+     are permitted in any medium without royalty provided the copyright
ce65b8
+     notice and this notice are preserved.  -->
ce65b8
+
ce65b8
+
ce65b8
+<target>
ce65b8
+  <architecture>powerpc:common</architecture>
ce65b8
+  <xi:include href="power-core.xml"/>
ce65b8
+  <xi:include href="power-fpu-isa205.xml"/>
ce65b8
+  <xi:include href="power-linux.xml"/>
ce65b8
+  <xi:include href="power-altivec.xml"/>
ce65b8
+  <xi:include href="power-vsx.xml"/>
ce65b8
+  <xi:include href="power-ppr.xml"/>
ce65b8
+  <xi:include href="power-dscr.xml"/>
ce65b8
+</target>
ce65b8
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c
ce65b8
@@ -0,0 +1,200 @@
ce65b8
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
ce65b8
+  Original: powerpc-isa205-ppr-dscr-vsx64l.xml */
ce65b8
+
ce65b8
+#include "defs.h"
ce65b8
+#include "osabi.h"
ce65b8
+#include "target-descriptions.h"
ce65b8
+
ce65b8
+struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
ce65b8
+static void
ce65b8
+initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l (void)
ce65b8
+{
ce65b8
+  struct target_desc *result = allocate_target_description ();
ce65b8
+  set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
ce65b8
+
ce65b8
+  struct tdesc_feature *feature;
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
ce65b8
+  tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "pc", 64, 1, NULL, 64, "code_ptr");
ce65b8
+  tdesc_create_reg (feature, "msr", 65, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32");
ce65b8
+  tdesc_create_reg (feature, "lr", 67, 1, NULL, 64, "code_ptr");
ce65b8
+  tdesc_create_reg (feature, "ctr", 68, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu");
ce65b8
+  tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double");
ce65b8
+  tdesc_create_reg (feature, "fpscr", 70, 1, "float", 64, "int");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux");
ce65b8
+  tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 64, "int");
ce65b8
+  tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
ce65b8
+  tdesc_type *element_type;
ce65b8
+  element_type = tdesc_named_type (feature, "ieee_single");
ce65b8
+  tdesc_create_vector (feature, "v4f", element_type, 4);
ce65b8
+
ce65b8
+  element_type = tdesc_named_type (feature, "int32");
ce65b8
+  tdesc_create_vector (feature, "v4i32", element_type, 4);
ce65b8
+
ce65b8
+  element_type = tdesc_named_type (feature, "int16");
ce65b8
+  tdesc_create_vector (feature, "v8i16", element_type, 8);
ce65b8
+
ce65b8
+  element_type = tdesc_named_type (feature, "int8");
ce65b8
+  tdesc_create_vector (feature, "v16i8", element_type, 16);
ce65b8
+
ce65b8
+  tdesc_type_with_fields *type_with_fields;
ce65b8
+  type_with_fields = tdesc_create_union (feature, "vec128");
ce65b8
+  tdesc_type *field_type;
ce65b8
+  field_type = tdesc_named_type (feature, "uint128");
ce65b8
+  tdesc_add_field (type_with_fields, "uint128", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v4f");
ce65b8
+  tdesc_add_field (type_with_fields, "v4_float", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v4i32");
ce65b8
+  tdesc_add_field (type_with_fields, "v4_int32", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v8i16");
ce65b8
+  tdesc_add_field (type_with_fields, "v8_int16", field_type);
ce65b8
+  field_type = tdesc_named_type (feature, "v16i8");
ce65b8
+  tdesc_add_field (type_with_fields, "v16_int8", field_type);
ce65b8
+
ce65b8
+  tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128");
ce65b8
+  tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int");
ce65b8
+  tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.vsx");
ce65b8
+  tdesc_create_reg (feature, "vs0h", 107, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs1h", 108, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs2h", 109, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs3h", 110, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs4h", 111, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs5h", 112, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs6h", 113, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs7h", 114, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs8h", 115, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs9h", 116, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs10h", 117, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs11h", 118, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs12h", 119, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs13h", 120, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs14h", 121, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs15h", 122, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs16h", 123, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs17h", 124, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs18h", 125, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs19h", 126, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs20h", 127, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs21h", 128, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs22h", 129, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs23h", 130, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs24h", 131, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs25h", 132, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs26h", 133, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs27h", 134, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs28h", 135, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs29h", 136, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs30h", 137, 1, NULL, 64, "uint64");
ce65b8
+  tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.ppr");
ce65b8
+  tdesc_create_reg (feature, "ppr", 139, 1, NULL, 64, "uint64");
ce65b8
+
ce65b8
+  feature = tdesc_create_feature (result, "org.gnu.gdb.power.dscr");
ce65b8
+  tdesc_create_reg (feature, "dscr", 140, 1, NULL, 64, "uint64");
ce65b8
+
ce65b8
+  tdesc_powerpc_isa205_ppr_dscr_vsx64l = result;
ce65b8
+}
ce65b8
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml
ce65b8
@@ -0,0 +1,18 @@
ce65b8
+
ce65b8
+
ce65b8
+
ce65b8
+     Copying and distribution of this file, with or without modification,
ce65b8
+     are permitted in any medium without royalty provided the copyright
ce65b8
+     notice and this notice are preserved.  -->
ce65b8
+
ce65b8
+
ce65b8
+<target>
ce65b8
+  <architecture>powerpc:common64</architecture>
ce65b8
+  <xi:include href="power64-core.xml"/>
ce65b8
+  <xi:include href="power-fpu-isa205.xml"/>
ce65b8
+  <xi:include href="power64-linux.xml"/>
ce65b8
+  <xi:include href="power-altivec.xml"/>
ce65b8
+  <xi:include href="power-vsx.xml"/>
ce65b8
+  <xi:include href="power-ppr.xml"/>
ce65b8
+  <xi:include href="power-dscr.xml"/>
ce65b8
+</target>
ce65b8
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
ce65b8
--- a/gdb/gdbserver/configure.srv
ce65b8
+++ b/gdb/gdbserver/configure.srv
ce65b8
@@ -32,7 +32,7 @@ else
ce65b8
    srv_amd64_linux_regobj=""
ce65b8
 fi
ce65b8
 
ce65b8
-ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o"
ce65b8
+ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o"
ce65b8
 
ce65b8
 # Linux object files.  This is so we don't have to repeat
ce65b8
 # these files over and over again.
ce65b8
@@ -217,6 +217,7 @@ case "${target}" in
ce65b8
 			srv_regobj="${srv_regobj} powerpc-isa205-32l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-isa205-altivec32l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-isa205-vsx32l.o"
ce65b8
+			srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx32l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-e500l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-64l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-altivec64l.o"
ce65b8
@@ -225,6 +226,7 @@ case "${target}" in
ce65b8
 			srv_regobj="${srv_regobj} powerpc-isa205-64l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
ce65b8
 			srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
ce65b8
+			srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx64l.o"
ce65b8
 			srv_tgtobj="$srv_linux_obj linux-ppc-low.o ppc-linux.o"
ce65b8
 			srv_tgtobj="${srv_tgtobj} arch/ppc-linux-common.o"
ce65b8
 			srv_xmlfiles="rs6000/powerpc-32l.xml"
ce65b8
@@ -234,12 +236,15 @@ case "${target}" in
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-32l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec32l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-vsx32l.xml"
ce65b8
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-altivec.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-vsx.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-linux.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu-isa205.xml"
ce65b8
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-dscr.xml"
ce65b8
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-ppr.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-e500l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml"
ce65b8
@@ -249,6 +254,7 @@ case "${target}" in
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-64l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec64l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-vsx64l.xml"
ce65b8
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml"
ce65b8
 			srv_xmlfiles="${srv_xmlfiles} rs6000/power64-linux.xml"
ce65b8
 			srv_linux_usrregs=yes
ce65b8
diff --git a/gdb/gdbserver/linux-ppc-ipa.c b/gdb/gdbserver/linux-ppc-ipa.c
ce65b8
--- a/gdb/gdbserver/linux-ppc-ipa.c
ce65b8
+++ b/gdb/gdbserver/linux-ppc-ipa.c
ce65b8
@@ -191,6 +191,8 @@ get_ipa_tdesc (int idx)
ce65b8
       return tdesc_powerpc_isa205_altivec64l;
ce65b8
     case PPC_TDESC_ISA205_VSX:
ce65b8
       return tdesc_powerpc_isa205_vsx64l;
ce65b8
+    case PPC_TDESC_ISA205_PPR_DSCR_VSX:
ce65b8
+      return tdesc_powerpc_isa205_ppr_dscr_vsx64l;
ce65b8
 #else
ce65b8
     case PPC_TDESC_BASE:
ce65b8
       return tdesc_powerpc_32l;
ce65b8
@@ -206,6 +208,8 @@ get_ipa_tdesc (int idx)
ce65b8
       return tdesc_powerpc_isa205_altivec32l;
ce65b8
     case PPC_TDESC_ISA205_VSX:
ce65b8
       return tdesc_powerpc_isa205_vsx32l;
ce65b8
+    case PPC_TDESC_ISA205_PPR_DSCR_VSX:
ce65b8
+      return tdesc_powerpc_isa205_ppr_dscr_vsx32l;
ce65b8
     case PPC_TDESC_E500:
ce65b8
       return tdesc_powerpc_e500l;
ce65b8
 #endif
ce65b8
@@ -234,6 +238,7 @@ initialize_low_tracepoint (void)
ce65b8
   init_registers_powerpc_isa205_64l ();
ce65b8
   init_registers_powerpc_isa205_altivec64l ();
ce65b8
   init_registers_powerpc_isa205_vsx64l ();
ce65b8
+  init_registers_powerpc_isa205_ppr_dscr_vsx64l ();
ce65b8
 #else
ce65b8
   init_registers_powerpc_32l ();
ce65b8
   init_registers_powerpc_altivec32l ();
ce65b8
@@ -242,6 +247,7 @@ initialize_low_tracepoint (void)
ce65b8
   init_registers_powerpc_isa205_32l ();
ce65b8
   init_registers_powerpc_isa205_altivec32l ();
ce65b8
   init_registers_powerpc_isa205_vsx32l ();
ce65b8
+  init_registers_powerpc_isa205_ppr_dscr_vsx32l ();
ce65b8
   init_registers_powerpc_e500l ();
ce65b8
 #endif
ce65b8
 }
ce65b8
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
ce65b8
--- a/gdb/gdbserver/linux-ppc-low.c
ce65b8
+++ b/gdb/gdbserver/linux-ppc-low.c
ce65b8
@@ -20,6 +20,8 @@
ce65b8
 #include "server.h"
ce65b8
 #include "linux-low.h"
ce65b8
 
ce65b8
+#include "elf/common.h"
ce65b8
+#include <sys/uio.h>
ce65b8
 #include <elf.h>
ce65b8
 #include <asm/ptrace.h>
ce65b8
 
ce65b8
@@ -41,8 +43,14 @@
ce65b8
 #define PPC_LI(insn)	(PPC_SEXT (PPC_FIELD (insn, 6, 24), 24) << 2)
ce65b8
 #define PPC_BD(insn)	(PPC_SEXT (PPC_FIELD (insn, 16, 14), 14) << 2)
ce65b8
 
ce65b8
+/* Holds the AT_HWCAP auxv entry.  */
ce65b8
+
ce65b8
 static unsigned long ppc_hwcap;
ce65b8
 
ce65b8
+/* Holds the AT_HWCAP2 auxv entry.  */
ce65b8
+
ce65b8
+static unsigned long ppc_hwcap2;
ce65b8
+
ce65b8
 
ce65b8
 #define ppc_num_regs 73
ce65b8
 
ce65b8
@@ -116,6 +124,24 @@ static int ppc_regmap_e500[] =
ce65b8
  };
ce65b8
 #endif
ce65b8
 
ce65b8
+/* Check whether the kernel provides a register set with number
ce65b8
+   REGSET_ID of size REGSETSIZE for process/thread TID.  */
ce65b8
+
ce65b8
+static int
ce65b8
+ppc_check_regset (int tid, int regset_id, int regsetsize)
ce65b8
+{
ce65b8
+  void *buf = alloca (regsetsize);
ce65b8
+  struct iovec iov;
ce65b8
+
ce65b8
+  iov.iov_base = buf;
ce65b8
+  iov.iov_len = regsetsize;
ce65b8
+
ce65b8
+  if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) >= 0
ce65b8
+      || errno == ENODATA)
ce65b8
+    return 1;
ce65b8
+  return 0;
ce65b8
+}
ce65b8
+
ce65b8
 static int
ce65b8
 ppc_cannot_store_register (int regno)
ce65b8
 {
ce65b8
@@ -459,6 +485,46 @@ static void ppc_fill_gregset (struct regcache *regcache, void *buf)
ce65b8
     ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]);
ce65b8
 }
ce65b8
 
ce65b8
+/* Program Priority Register regset fill function.  */
ce65b8
+
ce65b8
+static void
ce65b8
+ppc_fill_pprregset (struct regcache *regcache, void *buf)
ce65b8
+{
ce65b8
+  char *ppr = (char *) buf;
ce65b8
+
ce65b8
+  collect_register_by_name (regcache, "ppr", ppr);
ce65b8
+}
ce65b8
+
ce65b8
+/* Program Priority Register regset store function.  */
ce65b8
+
ce65b8
+static void
ce65b8
+ppc_store_pprregset (struct regcache *regcache, const void *buf)
ce65b8
+{
ce65b8
+  const char *ppr = (const char *) buf;
ce65b8
+
ce65b8
+  supply_register_by_name (regcache, "ppr", ppr);
ce65b8
+}
ce65b8
+
ce65b8
+/* Data Stream Control Register regset fill function.  */
ce65b8
+
ce65b8
+static void
ce65b8
+ppc_fill_dscrregset (struct regcache *regcache, void *buf)
ce65b8
+{
ce65b8
+  char *dscr = (char *) buf;
ce65b8
+
ce65b8
+  collect_register_by_name (regcache, "dscr", dscr);
ce65b8
+}
ce65b8
+
ce65b8
+/* Data Stream Control Register regset store function.  */
ce65b8
+
ce65b8
+static void
ce65b8
+ppc_store_dscrregset (struct regcache *regcache, const void *buf)
ce65b8
+{
ce65b8
+  const char *dscr = (const char *) buf;
ce65b8
+
ce65b8
+  supply_register_by_name (regcache, "dscr", dscr);
ce65b8
+}
ce65b8
+
ce65b8
 static void
ce65b8
 ppc_fill_vsxregset (struct regcache *regcache, void *buf)
ce65b8
 {
ce65b8
@@ -568,6 +634,10 @@ static struct regset_info ppc_regsets[] = {
ce65b8
      fetch them every time, but still fall back to PTRACE_PEEKUSER for the
ce65b8
      general registers.  Some kernels support these, but not the newer
ce65b8
      PPC_PTRACE_GETREGS.  */
ce65b8
+  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_PPR, 0, EXTENDED_REGS,
ce65b8
+    ppc_fill_pprregset, ppc_store_pprregset },
ce65b8
+  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_DSCR, 0, EXTENDED_REGS,
ce65b8
+    ppc_fill_dscrregset, ppc_store_dscrregset },
ce65b8
   { PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, 0, EXTENDED_REGS,
ce65b8
   ppc_fill_vsxregset, ppc_store_vsxregset },
ce65b8
   { PTRACE_GETVRREGS, PTRACE_SETVRREGS, 0, 0, EXTENDED_REGS,
ce65b8
@@ -625,6 +695,7 @@ ppc_arch_setup (void)
ce65b8
   /* The value of current_process ()->tdesc needs to be set for this
ce65b8
      call.  */
ce65b8
   ppc_get_auxv (AT_HWCAP, &ppc_hwcap);
ce65b8
+  ppc_get_auxv (AT_HWCAP2, &ppc_hwcap2);
ce65b8
 
ce65b8
   features.isa205 = ppc_linux_has_isa205 (ppc_hwcap);
ce65b8
 
ce65b8
@@ -634,6 +705,11 @@ ppc_arch_setup (void)
ce65b8
   if (ppc_hwcap & PPC_FEATURE_HAS_ALTIVEC)
ce65b8
     features.altivec = true;
ce65b8
 
ce65b8
+  if ((ppc_hwcap2 & PPC_FEATURE2_DSCR)
ce65b8
+      && ppc_check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET)
ce65b8
+      && ppc_check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET))
ce65b8
+    features.ppr_dscr = true;
ce65b8
+
ce65b8
   if (ppc_hwcap & PPC_FEATURE_CELL)
ce65b8
     features.cell = true;
ce65b8
 
ce65b8
@@ -678,6 +754,21 @@ ppc_arch_setup (void)
ce65b8
 	else
ce65b8
 	  regset->size = 0;
ce65b8
 	break;
ce65b8
+      case PTRACE_GETREGSET:
ce65b8
+	switch (regset->nt_type)
ce65b8
+	  {
ce65b8
+	  case NT_PPC_PPR:
ce65b8
+	    regset->size = (features.ppr_dscr ?
ce65b8
+			    PPC_LINUX_SIZEOF_PPRREGSET : 0);
ce65b8
+	    break;
ce65b8
+	  case NT_PPC_DSCR:
ce65b8
+	    regset->size = (features.ppr_dscr ?
ce65b8
+			    PPC_LINUX_SIZEOF_DSCRREGSET : 0);
ce65b8
+	    break;
ce65b8
+	  default:
ce65b8
+	    break;
ce65b8
+	  }
ce65b8
+	break;
ce65b8
       default:
ce65b8
 	break;
ce65b8
       }
ce65b8
@@ -3053,6 +3144,8 @@ ppc_get_ipa_tdesc_idx (void)
ce65b8
     return PPC_TDESC_ISA205_ALTIVEC;
ce65b8
   if (tdesc == tdesc_powerpc_isa205_vsx64l)
ce65b8
     return PPC_TDESC_ISA205_VSX;
ce65b8
+  if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx64l)
ce65b8
+    return PPC_TDESC_ISA205_PPR_DSCR_VSX;
ce65b8
 #endif
ce65b8
 
ce65b8
   if (tdesc == tdesc_powerpc_32l)
ce65b8
@@ -3069,6 +3162,8 @@ ppc_get_ipa_tdesc_idx (void)
ce65b8
     return PPC_TDESC_ISA205_ALTIVEC;
ce65b8
   if (tdesc == tdesc_powerpc_isa205_vsx32l)
ce65b8
     return PPC_TDESC_ISA205_VSX;
ce65b8
+  if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx32l)
ce65b8
+    return PPC_TDESC_ISA205_PPR_DSCR_VSX;
ce65b8
   if (tdesc == tdesc_powerpc_e500l)
ce65b8
     return PPC_TDESC_E500;
ce65b8
 
ce65b8
@@ -3127,6 +3222,7 @@ initialize_low_arch (void)
ce65b8
   init_registers_powerpc_isa205_32l ();
ce65b8
   init_registers_powerpc_isa205_altivec32l ();
ce65b8
   init_registers_powerpc_isa205_vsx32l ();
ce65b8
+  init_registers_powerpc_isa205_ppr_dscr_vsx32l ();
ce65b8
   init_registers_powerpc_e500l ();
ce65b8
 #if __powerpc64__
ce65b8
   init_registers_powerpc_64l ();
ce65b8
@@ -3136,6 +3232,7 @@ initialize_low_arch (void)
ce65b8
   init_registers_powerpc_isa205_64l ();
ce65b8
   init_registers_powerpc_isa205_altivec64l ();
ce65b8
   init_registers_powerpc_isa205_vsx64l ();
ce65b8
+  init_registers_powerpc_isa205_ppr_dscr_vsx64l ();
ce65b8
 #endif
ce65b8
 
ce65b8
   initialize_regsets_info (&ppc_regsets_info);
ce65b8
diff --git a/gdb/gdbserver/linux-ppc-tdesc-init.h b/gdb/gdbserver/linux-ppc-tdesc-init.h
ce65b8
--- a/gdb/gdbserver/linux-ppc-tdesc-init.h
ce65b8
+++ b/gdb/gdbserver/linux-ppc-tdesc-init.h
ce65b8
@@ -29,6 +29,7 @@ enum ppc_linux_tdesc {
ce65b8
   PPC_TDESC_ISA205,
ce65b8
   PPC_TDESC_ISA205_ALTIVEC,
ce65b8
   PPC_TDESC_ISA205_VSX,
ce65b8
+  PPC_TDESC_ISA205_PPR_DSCR_VSX,
ce65b8
   PPC_TDESC_E500,
ce65b8
 };
ce65b8
 
ce65b8
@@ -55,6 +56,9 @@ void init_registers_powerpc_isa205_altivec32l (void);
ce65b8
 /* Defined in auto-generated file powerpc-isa205-vsx32l.c.  */
ce65b8
 void init_registers_powerpc_isa205_vsx32l (void);
ce65b8
 
ce65b8
+/* Defined in auto-generated file powerpc-isa205-ppr-dscr-vsx32l.c.  */
ce65b8
+void init_registers_powerpc_isa205_ppr_dscr_vsx32l (void);
ce65b8
+
ce65b8
 /* Defined in auto-generated file powerpc-e500l.c.  */
ce65b8
 void init_registers_powerpc_e500l (void);
ce65b8
 
ce65b8
@@ -83,4 +87,7 @@ void init_registers_powerpc_isa205_altivec64l (void);
ce65b8
 /* Defined in auto-generated file powerpc-isa205-vsx64l.c.  */
ce65b8
 void init_registers_powerpc_isa205_vsx64l (void);
ce65b8
 
ce65b8
+/* Defined in auto-generated file powerpc-isa205-ppr-dscr-vsx64l.c.  */
ce65b8
+void init_registers_powerpc_isa205_ppr_dscr_vsx64l (void);
ce65b8
+
ce65b8
 #endif
ce65b8
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
ce65b8
--- a/gdb/nat/ppc-linux.h
ce65b8
+++ b/gdb/nat/ppc-linux.h
ce65b8
@@ -51,6 +51,9 @@
ce65b8
 #ifndef PPC_FEATURE_HAS_SPE
ce65b8
 #define PPC_FEATURE_HAS_SPE 0x00800000
ce65b8
 #endif
ce65b8
+#ifndef PPC_FEATURE2_DSCR
ce65b8
+#define PPC_FEATURE2_DSCR 0x20000000
ce65b8
+#endif
ce65b8
 
ce65b8
 /* Glibc's headers don't define PTRACE_GETVRREGS so we cannot use a
ce65b8
    configure time check.  Some older glibc's (for instance 2.2.1)
ce65b8
@@ -82,6 +85,16 @@
ce65b8
 #define PTRACE_SETEVRREGS 21
ce65b8
 #endif
ce65b8
 
ce65b8
+/* Program Priority Register.  */
ce65b8
+#ifndef NT_PPC_PPR
ce65b8
+#define NT_PPC_PPR 0x104
ce65b8
+#endif
ce65b8
+
ce65b8
+/* Data Stream Control Register.  */
ce65b8
+#ifndef NT_PPC_DSCR
ce65b8
+#define NT_PPC_DSCR 0x105
ce65b8
+#endif
ce65b8
+
ce65b8
 /* Return the wordsize of the target, either 4 or 8 bytes.  */
ce65b8
 int ppc_linux_target_wordsize (int tid);
ce65b8
 
ce65b8
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
ce65b8
--- a/gdb/ppc-linux-nat.c
ce65b8
+++ b/gdb/ppc-linux-nat.c
ce65b8
@@ -31,6 +31,7 @@
ce65b8
 #include <signal.h>
ce65b8
 #include <sys/user.h>
ce65b8
 #include <sys/ioctl.h>
ce65b8
+#include <sys/uio.h>
ce65b8
 #include "gdb_wait.h"
ce65b8
 #include <fcntl.h>
ce65b8
 #include <sys/procfs.h>
ce65b8
@@ -528,6 +529,78 @@ fetch_spe_register (struct regcache *regcache, int tid, int regno)
ce65b8
     regcache->raw_supply (tdep->ppc_spefscr_regnum, &evrregs.spefscr);
ce65b8
 }
ce65b8
 
ce65b8
+/* Use ptrace to fetch all registers from the register set with note
ce65b8
+   type REGSET_ID, size REGSIZE, and layout described by REGSET, from
ce65b8
+   process/thread TID and supply their values to REGCACHE.  If ptrace
ce65b8
+   returns ENODATA to indicate the regset is unavailable, mark the
ce65b8
+   registers as unavailable in REGCACHE.  */
ce65b8
+
ce65b8
+static void
ce65b8
+fetch_regset (struct regcache *regcache, int tid,
ce65b8
+	      int regset_id, int regsetsize, const struct regset *regset)
ce65b8
+{
ce65b8
+  void *buf = alloca (regsetsize);
ce65b8
+  struct iovec iov;
ce65b8
+
ce65b8
+  iov.iov_base = buf;
ce65b8
+  iov.iov_len = regsetsize;
ce65b8
+
ce65b8
+  if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) < 0)
ce65b8
+    {
ce65b8
+      if (errno == ENODATA)
ce65b8
+	regset->supply_regset (regset, regcache, -1, NULL, regsetsize);
ce65b8
+      else
ce65b8
+	perror_with_name (_("Couldn't get register set"));
ce65b8
+    }
ce65b8
+  else
ce65b8
+    regset->supply_regset (regset, regcache, -1, buf, regsetsize);
ce65b8
+}
ce65b8
+
ce65b8
+/* Use ptrace to store register REGNUM of the regset with note type
ce65b8
+   REGSET_ID, size REGSETSIZE, and layout described by REGSET, from
ce65b8
+   REGCACHE back to process/thread TID.  If REGNUM is -1 all registers
ce65b8
+   in the set are collected and stored.  */
ce65b8
+
ce65b8
+static void
ce65b8
+store_regset (const struct regcache *regcache, int tid, int regnum,
ce65b8
+	      int regset_id, int regsetsize, const struct regset *regset)
ce65b8
+{
ce65b8
+  void *buf = alloca (regsetsize);
ce65b8
+  struct iovec iov;
ce65b8
+
ce65b8
+  iov.iov_base = buf;
ce65b8
+  iov.iov_len = regsetsize;
ce65b8
+
ce65b8
+  /* Make sure that the buffer that will be stored has up to date values
ce65b8
+     for the registers that won't be collected.  */
ce65b8
+  if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) < 0)
ce65b8
+    perror_with_name (_("Couldn't get register set"));
ce65b8
+
ce65b8
+  regset->collect_regset (regset, regcache, regnum, buf, regsetsize);
ce65b8
+
ce65b8
+  if (ptrace (PTRACE_SETREGSET, tid, regset_id, &iov) < 0)
ce65b8
+    perror_with_name (_("Couldn't set register set"));
ce65b8
+}
ce65b8
+
ce65b8
+/* Check whether the kernel provides a register set with number
ce65b8
+   REGSET_ID of size REGSETSIZE for process/thread TID.  */
ce65b8
+
ce65b8
+static bool
ce65b8
+check_regset (int tid, int regset_id, int regsetsize)
ce65b8
+{
ce65b8
+  void *buf = alloca (regsetsize);
ce65b8
+  struct iovec iov;
ce65b8
+
ce65b8
+  iov.iov_base = buf;
ce65b8
+  iov.iov_len = regsetsize;
ce65b8
+
ce65b8
+  if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) >= 0
ce65b8
+      || errno == ENODATA)
ce65b8
+    return true;
ce65b8
+  else
ce65b8
+    return false;
ce65b8
+}
ce65b8
+
ce65b8
 static void
ce65b8
 fetch_register (struct regcache *regcache, int tid, int regno)
ce65b8
 {
ce65b8
@@ -567,6 +640,24 @@ fetch_register (struct regcache *regcache, int tid, int regno)
ce65b8
       fetch_spe_register (regcache, tid, regno);
ce65b8
       return;
ce65b8
     }
ce65b8
+  else if (regno == PPC_DSCR_REGNUM)
ce65b8
+    {
ce65b8
+      gdb_assert (tdep->ppc_dscr_regnum != -1);
ce65b8
+
ce65b8
+      fetch_regset (regcache, tid, NT_PPC_DSCR,
ce65b8
+		    PPC_LINUX_SIZEOF_DSCRREGSET,
ce65b8
+		    &ppc32_linux_dscrregset);
ce65b8
+      return;
ce65b8
+    }
ce65b8
+  else if (regno == PPC_PPR_REGNUM)
ce65b8
+    {
ce65b8
+      gdb_assert (tdep->ppc_ppr_regnum != -1);
ce65b8
+
ce65b8
+      fetch_regset (regcache, tid, NT_PPC_PPR,
ce65b8
+		    PPC_LINUX_SIZEOF_PPRREGSET,
ce65b8
+		    &ppc32_linux_pprregset);
ce65b8
+      return;
ce65b8
+    }
ce65b8
 
ce65b8
   if (regaddr == -1)
ce65b8
     {
ce65b8
@@ -763,6 +854,14 @@ fetch_ppc_registers (struct regcache *regcache, int tid)
ce65b8
       fetch_vsx_registers (regcache, tid, -1);
ce65b8
   if (tdep->ppc_ev0_upper_regnum >= 0)
ce65b8
     fetch_spe_register (regcache, tid, -1);
ce65b8
+  if (tdep->ppc_ppr_regnum != -1)
ce65b8
+    fetch_regset (regcache, tid, NT_PPC_PPR,
ce65b8
+		  PPC_LINUX_SIZEOF_PPRREGSET,
ce65b8
+		  &ppc32_linux_pprregset);
ce65b8
+  if (tdep->ppc_dscr_regnum != -1)
ce65b8
+    fetch_regset (regcache, tid, NT_PPC_DSCR,
ce65b8
+		  PPC_LINUX_SIZEOF_DSCRREGSET,
ce65b8
+		  &ppc32_linux_dscrregset);
ce65b8
 }
ce65b8
 
ce65b8
 /* Fetch registers from the child process.  Fetch all registers if
ce65b8
@@ -943,6 +1042,24 @@ store_register (const struct regcache *regcache, int tid, int regno)
ce65b8
       store_spe_register (regcache, tid, regno);
ce65b8
       return;
ce65b8
     }
ce65b8
+  else if (regno == PPC_DSCR_REGNUM)
ce65b8
+    {
ce65b8
+      gdb_assert (tdep->ppc_dscr_regnum != -1);
ce65b8
+
ce65b8
+      store_regset (regcache, tid, regno, NT_PPC_DSCR,
ce65b8
+		    PPC_LINUX_SIZEOF_DSCRREGSET,
ce65b8
+		    &ppc32_linux_dscrregset);
ce65b8
+      return;
ce65b8
+    }
ce65b8
+  else if (regno == PPC_PPR_REGNUM)
ce65b8
+    {
ce65b8
+      gdb_assert (tdep->ppc_ppr_regnum != -1);
ce65b8
+
ce65b8
+      store_regset (regcache, tid, regno, NT_PPC_PPR,
ce65b8
+		    PPC_LINUX_SIZEOF_PPRREGSET,
ce65b8
+		    &ppc32_linux_pprregset);
ce65b8
+      return;
ce65b8
+    }
ce65b8
 
ce65b8
   if (regaddr == -1)
ce65b8
     return;
ce65b8
@@ -1157,6 +1274,14 @@ store_ppc_registers (const struct regcache *regcache, int tid)
ce65b8
       store_vsx_registers (regcache, tid, -1);
ce65b8
   if (tdep->ppc_ev0_upper_regnum >= 0)
ce65b8
     store_spe_register (regcache, tid, -1);
ce65b8
+  if (tdep->ppc_ppr_regnum != -1)
ce65b8
+    store_regset (regcache, tid, -1, NT_PPC_PPR,
ce65b8
+		  PPC_LINUX_SIZEOF_PPRREGSET,
ce65b8
+		  &ppc32_linux_pprregset);
ce65b8
+  if (tdep->ppc_dscr_regnum != -1)
ce65b8
+    store_regset (regcache, tid, -1, NT_PPC_DSCR,
ce65b8
+		  PPC_LINUX_SIZEOF_DSCRREGSET,
ce65b8
+		  &ppc32_linux_dscrregset);
ce65b8
 }
ce65b8
 
ce65b8
 /* Fetch the AT_HWCAP entry from the aux vector.  */
ce65b8
@@ -1171,6 +1296,19 @@ ppc_linux_get_hwcap (void)
ce65b8
   return field;
ce65b8
 }
ce65b8
 
ce65b8
+/* Fetch the AT_HWCAP2 entry from the aux vector.  */
ce65b8
+
ce65b8
+static CORE_ADDR
ce65b8
+ppc_linux_get_hwcap2 (void)
ce65b8
+{
ce65b8
+  CORE_ADDR field;
ce65b8
+
ce65b8
+  if (target_auxv_search (current_top_target (), AT_HWCAP2, &field) != 1)
ce65b8
+    return 0;
ce65b8
+
ce65b8
+  return field;
ce65b8
+}
ce65b8
+
ce65b8
 /* The cached DABR value, to install in new threads.
ce65b8
    This variable is used when the PowerPC HWDEBUG ptrace
ce65b8
    interface is not available.  */
ce65b8
@@ -2233,6 +2371,7 @@ ppc_linux_nat_target::read_description ()
ce65b8
   features.wordsize = ppc_linux_target_wordsize (tid);
ce65b8
 
ce65b8
   CORE_ADDR hwcap = ppc_linux_get_hwcap ();
ce65b8
+  CORE_ADDR hwcap2 = ppc_linux_get_hwcap2 ();
ce65b8
 
ce65b8
   if (have_ptrace_getsetvsxregs
ce65b8
       && (hwcap & PPC_FEATURE_HAS_VSX))
ce65b8
@@ -2267,6 +2406,11 @@ ppc_linux_nat_target::read_description ()
ce65b8
 
ce65b8
   features.isa205 = ppc_linux_has_isa205 (hwcap);
ce65b8
 
ce65b8
+  if ((hwcap2 & PPC_FEATURE2_DSCR)
ce65b8
+      && check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET)
ce65b8
+      && check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET))
ce65b8
+    features.ppr_dscr = true;
ce65b8
+
ce65b8
   return ppc_linux_match_description (features);
ce65b8
 }
ce65b8
 
ce65b8
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
ce65b8
--- a/gdb/ppc-linux-tdep.c
ce65b8
+++ b/gdb/ppc-linux-tdep.c
ce65b8
@@ -71,6 +71,7 @@
ce65b8
 #include "features/rs6000/powerpc-isa205-32l.c"
ce65b8
 #include "features/rs6000/powerpc-isa205-altivec32l.c"
ce65b8
 #include "features/rs6000/powerpc-isa205-vsx32l.c"
ce65b8
+#include "features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c"
ce65b8
 #include "features/rs6000/powerpc-64l.c"
ce65b8
 #include "features/rs6000/powerpc-altivec64l.c"
ce65b8
 #include "features/rs6000/powerpc-cell64l.c"
ce65b8
@@ -78,6 +79,7 @@
ce65b8
 #include "features/rs6000/powerpc-isa205-64l.c"
ce65b8
 #include "features/rs6000/powerpc-isa205-altivec64l.c"
ce65b8
 #include "features/rs6000/powerpc-isa205-vsx64l.c"
ce65b8
+#include "features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c"
ce65b8
 #include "features/rs6000/powerpc-e500l.c"
ce65b8
 
ce65b8
 /* Shared library operations for PowerPC-Linux.  */
ce65b8
@@ -547,6 +549,38 @@ static const struct regset ppc32_linux_vsxregset = {
ce65b8
   regcache_collect_regset
ce65b8
 };
ce65b8
 
ce65b8
+/* Program Priorty Register regmap.  */
ce65b8
+
ce65b8
+static const struct regcache_map_entry ppc32_regmap_ppr[] =
ce65b8
+  {
ce65b8
+      { 1, PPC_PPR_REGNUM, 8 },
ce65b8
+      { 0 }
ce65b8
+  };
ce65b8
+
ce65b8
+/* Program Priorty Register regset.  */
ce65b8
+
ce65b8
+const struct regset ppc32_linux_pprregset = {
ce65b8
+  ppc32_regmap_ppr,
ce65b8
+  regcache_supply_regset,
ce65b8
+  regcache_collect_regset
ce65b8
+};
ce65b8
+
ce65b8
+/* Data Stream Control Register regmap.  */
ce65b8
+
ce65b8
+static const struct regcache_map_entry ppc32_regmap_dscr[] =
ce65b8
+  {
ce65b8
+      { 1, PPC_DSCR_REGNUM, 8 },
ce65b8
+      { 0 }
ce65b8
+  };
ce65b8
+
ce65b8
+/* Data Stream Control Register regset.  */
ce65b8
+
ce65b8
+const struct regset ppc32_linux_dscrregset = {
ce65b8
+  ppc32_regmap_dscr,
ce65b8
+  regcache_supply_regset,
ce65b8
+  regcache_collect_regset
ce65b8
+};
ce65b8
+
ce65b8
 const struct regset *
ce65b8
 ppc_linux_gregset (int wordsize)
ce65b8
 {
ce65b8
@@ -585,6 +619,8 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
ce65b8
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ce65b8
   int have_altivec = tdep->ppc_vr0_regnum != -1;
ce65b8
   int have_vsx = tdep->ppc_vsr0_upper_regnum != -1;
ce65b8
+  int have_ppr = tdep->ppc_ppr_regnum != -1;
ce65b8
+  int have_dscr = tdep->ppc_dscr_regnum != -1;
ce65b8
 
ce65b8
   if (tdep->wordsize == 4)
ce65b8
     cb (".reg", 48 * 4, 48 * 4, &ppc32_linux_gregset, NULL, cb_data);
ce65b8
@@ -603,6 +639,17 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
ce65b8
   if (have_vsx)
ce65b8
     cb (".reg-ppc-vsx", PPC_LINUX_SIZEOF_VSXREGSET, PPC_LINUX_SIZEOF_VSXREGSET,
ce65b8
 	&ppc32_linux_vsxregset, "POWER7 VSX", cb_data);
ce65b8
+
ce65b8
+  if (have_ppr)
ce65b8
+    cb (".reg-ppc-ppr", PPC_LINUX_SIZEOF_PPRREGSET,
ce65b8
+	PPC_LINUX_SIZEOF_PPRREGSET,
ce65b8
+	&ppc32_linux_pprregset, "Priority Program Register", cb_data);
ce65b8
+
ce65b8
+  if (have_dscr)
ce65b8
+    cb (".reg-ppc-dscr", PPC_LINUX_SIZEOF_DSCRREGSET,
ce65b8
+	PPC_LINUX_SIZEOF_DSCRREGSET,
ce65b8
+	&ppc32_linux_dscrregset, "Data Stream Control Register",
ce65b8
+	cb_data);
ce65b8
 }
ce65b8
 
ce65b8
 static void
ce65b8
@@ -1015,6 +1062,8 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
ce65b8
   asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx");
ce65b8
   asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx");
ce65b8
   asection *section = bfd_get_section_by_name (abfd, ".reg");
ce65b8
+  asection *ppr = bfd_get_section_by_name (abfd, ".reg-ppc-ppr");
ce65b8
+  asection *dscr = bfd_get_section_by_name (abfd, ".reg-ppc-dscr");
ce65b8
 
ce65b8
   if (! section)
ce65b8
     return NULL;
ce65b8
@@ -1047,6 +1096,9 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
ce65b8
 
ce65b8
   features.isa205 = ppc_linux_has_isa205 (hwcap);
ce65b8
 
ce65b8
+  if (ppr && dscr)
ce65b8
+    features.ppr_dscr = true;
ce65b8
+
ce65b8
   return ppc_linux_match_description (features);
ce65b8
 }
ce65b8
 
ce65b8
@@ -1920,6 +1972,7 @@ _initialize_ppc_linux_tdep (void)
ce65b8
   initialize_tdesc_powerpc_isa205_32l ();
ce65b8
   initialize_tdesc_powerpc_isa205_altivec32l ();
ce65b8
   initialize_tdesc_powerpc_isa205_vsx32l ();
ce65b8
+  initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l ();
ce65b8
   initialize_tdesc_powerpc_64l ();
ce65b8
   initialize_tdesc_powerpc_altivec64l ();
ce65b8
   initialize_tdesc_powerpc_cell64l ();
ce65b8
@@ -1927,5 +1980,6 @@ _initialize_ppc_linux_tdep (void)
ce65b8
   initialize_tdesc_powerpc_isa205_64l ();
ce65b8
   initialize_tdesc_powerpc_isa205_altivec64l ();
ce65b8
   initialize_tdesc_powerpc_isa205_vsx64l ();
ce65b8
+  initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l ();
ce65b8
   initialize_tdesc_powerpc_e500l ();
ce65b8
 }
ce65b8
diff --git a/gdb/ppc-linux-tdep.h b/gdb/ppc-linux-tdep.h
ce65b8
--- a/gdb/ppc-linux-tdep.h
ce65b8
+++ b/gdb/ppc-linux-tdep.h
ce65b8
@@ -44,4 +44,8 @@ enum {
ce65b8
 /* Return 1 if PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM are usable.  */
ce65b8
 int ppc_linux_trap_reg_p (struct gdbarch *gdbarch);
ce65b8
 
ce65b8
+/* Additional register sets, defined in ppc-linux-tdep.c.  */
ce65b8
+extern const struct regset ppc32_linux_pprregset;
ce65b8
+extern const struct regset ppc32_linux_dscrregset;
ce65b8
+
ce65b8
 #endif /* PPC_LINUX_TDEP_H */
ce65b8
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
ce65b8
--- a/gdb/ppc-tdep.h
ce65b8
+++ b/gdb/ppc-tdep.h
ce65b8
@@ -253,6 +253,12 @@ struct gdbarch_tdep
ce65b8
     int ppc_acc_regnum;         /* SPE 'acc' register.  */
ce65b8
     int ppc_spefscr_regnum;     /* SPE 'spefscr' register.  */
ce65b8
 
ce65b8
+    /* Program Priority Register.  */
ce65b8
+    int ppc_ppr_regnum;
ce65b8
+
ce65b8
+    /* Data Stream Control Register.  */
ce65b8
+    int ppc_dscr_regnum;
ce65b8
+
ce65b8
     /* Decimal 128 registers.  */
ce65b8
     int ppc_dl0_regnum;		/* First Decimal128 argument register pair.  */
ce65b8
 
ce65b8
@@ -309,6 +315,8 @@ enum {
ce65b8
   PPC_VRSAVE_REGNUM = 139,
ce65b8
   PPC_VSR0_UPPER_REGNUM = 140,
ce65b8
   PPC_VSR31_UPPER_REGNUM = 171,
ce65b8
+  PPC_PPR_REGNUM = 172,
ce65b8
+  PPC_DSCR_REGNUM = 173,
ce65b8
   PPC_NUM_REGS
ce65b8
 };
ce65b8
 
ce65b8
diff --git a/gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx32l.dat b/gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx32l.dat
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx32l.dat
ce65b8
@@ -0,0 +1,146 @@
ce65b8
+# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
ce65b8
+# Generated from: rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml
ce65b8
+name:powerpc_isa205_ppr_dscr_vsx32l
ce65b8
+xmltarget:powerpc-isa205-ppr-dscr-vsx32l.xml
ce65b8
+expedite:r1,pc
ce65b8
+32:r0
ce65b8
+32:r1
ce65b8
+32:r2
ce65b8
+32:r3
ce65b8
+32:r4
ce65b8
+32:r5
ce65b8
+32:r6
ce65b8
+32:r7
ce65b8
+32:r8
ce65b8
+32:r9
ce65b8
+32:r10
ce65b8
+32:r11
ce65b8
+32:r12
ce65b8
+32:r13
ce65b8
+32:r14
ce65b8
+32:r15
ce65b8
+32:r16
ce65b8
+32:r17
ce65b8
+32:r18
ce65b8
+32:r19
ce65b8
+32:r20
ce65b8
+32:r21
ce65b8
+32:r22
ce65b8
+32:r23
ce65b8
+32:r24
ce65b8
+32:r25
ce65b8
+32:r26
ce65b8
+32:r27
ce65b8
+32:r28
ce65b8
+32:r29
ce65b8
+32:r30
ce65b8
+32:r31
ce65b8
+64:f0
ce65b8
+64:f1
ce65b8
+64:f2
ce65b8
+64:f3
ce65b8
+64:f4
ce65b8
+64:f5
ce65b8
+64:f6
ce65b8
+64:f7
ce65b8
+64:f8
ce65b8
+64:f9
ce65b8
+64:f10
ce65b8
+64:f11
ce65b8
+64:f12
ce65b8
+64:f13
ce65b8
+64:f14
ce65b8
+64:f15
ce65b8
+64:f16
ce65b8
+64:f17
ce65b8
+64:f18
ce65b8
+64:f19
ce65b8
+64:f20
ce65b8
+64:f21
ce65b8
+64:f22
ce65b8
+64:f23
ce65b8
+64:f24
ce65b8
+64:f25
ce65b8
+64:f26
ce65b8
+64:f27
ce65b8
+64:f28
ce65b8
+64:f29
ce65b8
+64:f30
ce65b8
+64:f31
ce65b8
+32:pc
ce65b8
+32:msr
ce65b8
+32:cr
ce65b8
+32:lr
ce65b8
+32:ctr
ce65b8
+32:xer
ce65b8
+64:fpscr
ce65b8
+32:orig_r3
ce65b8
+32:trap
ce65b8
+128:vr0
ce65b8
+128:vr1
ce65b8
+128:vr2
ce65b8
+128:vr3
ce65b8
+128:vr4
ce65b8
+128:vr5
ce65b8
+128:vr6
ce65b8
+128:vr7
ce65b8
+128:vr8
ce65b8
+128:vr9
ce65b8
+128:vr10
ce65b8
+128:vr11
ce65b8
+128:vr12
ce65b8
+128:vr13
ce65b8
+128:vr14
ce65b8
+128:vr15
ce65b8
+128:vr16
ce65b8
+128:vr17
ce65b8
+128:vr18
ce65b8
+128:vr19
ce65b8
+128:vr20
ce65b8
+128:vr21
ce65b8
+128:vr22
ce65b8
+128:vr23
ce65b8
+128:vr24
ce65b8
+128:vr25
ce65b8
+128:vr26
ce65b8
+128:vr27
ce65b8
+128:vr28
ce65b8
+128:vr29
ce65b8
+128:vr30
ce65b8
+128:vr31
ce65b8
+32:vscr
ce65b8
+32:vrsave
ce65b8
+64:vs0h
ce65b8
+64:vs1h
ce65b8
+64:vs2h
ce65b8
+64:vs3h
ce65b8
+64:vs4h
ce65b8
+64:vs5h
ce65b8
+64:vs6h
ce65b8
+64:vs7h
ce65b8
+64:vs8h
ce65b8
+64:vs9h
ce65b8
+64:vs10h
ce65b8
+64:vs11h
ce65b8
+64:vs12h
ce65b8
+64:vs13h
ce65b8
+64:vs14h
ce65b8
+64:vs15h
ce65b8
+64:vs16h
ce65b8
+64:vs17h
ce65b8
+64:vs18h
ce65b8
+64:vs19h
ce65b8
+64:vs20h
ce65b8
+64:vs21h
ce65b8
+64:vs22h
ce65b8
+64:vs23h
ce65b8
+64:vs24h
ce65b8
+64:vs25h
ce65b8
+64:vs26h
ce65b8
+64:vs27h
ce65b8
+64:vs28h
ce65b8
+64:vs29h
ce65b8
+64:vs30h
ce65b8
+64:vs31h
ce65b8
+64:ppr
ce65b8
+64:dscr
ce65b8
diff --git a/gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat b/gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat
ce65b8
@@ -0,0 +1,146 @@
ce65b8
+# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
ce65b8
+# Generated from: rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml
ce65b8
+name:powerpc_isa205_ppr_dscr_vsx64l
ce65b8
+xmltarget:powerpc-isa205-ppr-dscr-vsx64l.xml
ce65b8
+expedite:r1,pc
ce65b8
+64:r0
ce65b8
+64:r1
ce65b8
+64:r2
ce65b8
+64:r3
ce65b8
+64:r4
ce65b8
+64:r5
ce65b8
+64:r6
ce65b8
+64:r7
ce65b8
+64:r8
ce65b8
+64:r9
ce65b8
+64:r10
ce65b8
+64:r11
ce65b8
+64:r12
ce65b8
+64:r13
ce65b8
+64:r14
ce65b8
+64:r15
ce65b8
+64:r16
ce65b8
+64:r17
ce65b8
+64:r18
ce65b8
+64:r19
ce65b8
+64:r20
ce65b8
+64:r21
ce65b8
+64:r22
ce65b8
+64:r23
ce65b8
+64:r24
ce65b8
+64:r25
ce65b8
+64:r26
ce65b8
+64:r27
ce65b8
+64:r28
ce65b8
+64:r29
ce65b8
+64:r30
ce65b8
+64:r31
ce65b8
+64:f0
ce65b8
+64:f1
ce65b8
+64:f2
ce65b8
+64:f3
ce65b8
+64:f4
ce65b8
+64:f5
ce65b8
+64:f6
ce65b8
+64:f7
ce65b8
+64:f8
ce65b8
+64:f9
ce65b8
+64:f10
ce65b8
+64:f11
ce65b8
+64:f12
ce65b8
+64:f13
ce65b8
+64:f14
ce65b8
+64:f15
ce65b8
+64:f16
ce65b8
+64:f17
ce65b8
+64:f18
ce65b8
+64:f19
ce65b8
+64:f20
ce65b8
+64:f21
ce65b8
+64:f22
ce65b8
+64:f23
ce65b8
+64:f24
ce65b8
+64:f25
ce65b8
+64:f26
ce65b8
+64:f27
ce65b8
+64:f28
ce65b8
+64:f29
ce65b8
+64:f30
ce65b8
+64:f31
ce65b8
+64:pc
ce65b8
+64:msr
ce65b8
+32:cr
ce65b8
+64:lr
ce65b8
+64:ctr
ce65b8
+32:xer
ce65b8
+64:fpscr
ce65b8
+64:orig_r3
ce65b8
+64:trap
ce65b8
+128:vr0
ce65b8
+128:vr1
ce65b8
+128:vr2
ce65b8
+128:vr3
ce65b8
+128:vr4
ce65b8
+128:vr5
ce65b8
+128:vr6
ce65b8
+128:vr7
ce65b8
+128:vr8
ce65b8
+128:vr9
ce65b8
+128:vr10
ce65b8
+128:vr11
ce65b8
+128:vr12
ce65b8
+128:vr13
ce65b8
+128:vr14
ce65b8
+128:vr15
ce65b8
+128:vr16
ce65b8
+128:vr17
ce65b8
+128:vr18
ce65b8
+128:vr19
ce65b8
+128:vr20
ce65b8
+128:vr21
ce65b8
+128:vr22
ce65b8
+128:vr23
ce65b8
+128:vr24
ce65b8
+128:vr25
ce65b8
+128:vr26
ce65b8
+128:vr27
ce65b8
+128:vr28
ce65b8
+128:vr29
ce65b8
+128:vr30
ce65b8
+128:vr31
ce65b8
+32:vscr
ce65b8
+32:vrsave
ce65b8
+64:vs0h
ce65b8
+64:vs1h
ce65b8
+64:vs2h
ce65b8
+64:vs3h
ce65b8
+64:vs4h
ce65b8
+64:vs5h
ce65b8
+64:vs6h
ce65b8
+64:vs7h
ce65b8
+64:vs8h
ce65b8
+64:vs9h
ce65b8
+64:vs10h
ce65b8
+64:vs11h
ce65b8
+64:vs12h
ce65b8
+64:vs13h
ce65b8
+64:vs14h
ce65b8
+64:vs15h
ce65b8
+64:vs16h
ce65b8
+64:vs17h
ce65b8
+64:vs18h
ce65b8
+64:vs19h
ce65b8
+64:vs20h
ce65b8
+64:vs21h
ce65b8
+64:vs22h
ce65b8
+64:vs23h
ce65b8
+64:vs24h
ce65b8
+64:vs25h
ce65b8
+64:vs26h
ce65b8
+64:vs27h
ce65b8
+64:vs28h
ce65b8
+64:vs29h
ce65b8
+64:vs30h
ce65b8
+64:vs31h
ce65b8
+64:ppr
ce65b8
+64:dscr
ce65b8
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
ce65b8
--- a/gdb/rs6000-tdep.c
ce65b8
+++ b/gdb/rs6000-tdep.c
ce65b8
@@ -4466,6 +4466,17 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
ce65b8
     case 570:		/* Count Trailing Zeros Doubleword */
ce65b8
     case 890:		/* Extend-Sign Word and Shift Left Immediate (445) */
ce65b8
     case 890 | 1:	/* Extend-Sign Word and Shift Left Immediate (445) */
ce65b8
+
ce65b8
+      if (ext == 444 && tdep->ppc_ppr_regnum >= 0
ce65b8
+	  && (PPC_RS (insn) == PPC_RA (insn))
ce65b8
+	  && (PPC_RA (insn) == PPC_RB (insn))
ce65b8
+	  && !PPC_RC (insn))
ce65b8
+	{
ce65b8
+	  /* or Rx,Rx,Rx alters PRI in PPR.  */
ce65b8
+	  record_full_arch_list_add_reg (regcache, tdep->ppc_ppr_regnum);
ce65b8
+	  return 0;
ce65b8
+	}
ce65b8
+
ce65b8
       if (PPC_RC (insn))
ce65b8
 	record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
ce65b8
       record_full_arch_list_add_reg (regcache,
ce65b8
@@ -4675,6 +4686,10 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
ce65b8
 	case 1:			/* XER */
ce65b8
 	  record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
ce65b8
 	  return 0;
ce65b8
+	case 3:			/* DSCR */
ce65b8
+	  if (tdep->ppc_dscr_regnum >= 0)
ce65b8
+	    record_full_arch_list_add_reg (regcache, tdep->ppc_dscr_regnum);
ce65b8
+	  return 0;
ce65b8
 	case 8:			/* LR */
ce65b8
 	  record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum);
ce65b8
 	  return 0;
ce65b8
@@ -4684,6 +4699,11 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
ce65b8
 	case 256:		/* VRSAVE */
ce65b8
 	  record_full_arch_list_add_reg (regcache, tdep->ppc_vrsave_regnum);
ce65b8
 	  return 0;
ce65b8
+	case 896:
ce65b8
+	case 898:		/* PPR */
ce65b8
+	  if (tdep->ppc_ppr_regnum >= 0)
ce65b8
+	    record_full_arch_list_add_reg (regcache, tdep->ppc_ppr_regnum);
ce65b8
+	  return 0;
ce65b8
 	}
ce65b8
 
ce65b8
       goto UNKNOWN_OP;
ce65b8
@@ -5846,7 +5866,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
ce65b8
   enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global;
ce65b8
   enum powerpc_elf_abi elf_abi = POWERPC_ELF_AUTO;
ce65b8
   int have_fpu = 0, have_spe = 0, have_mq = 0, have_altivec = 0;
ce65b8
-  int have_dfp = 0, have_vsx = 0;
ce65b8
+  int have_dfp = 0, have_vsx = 0, have_ppr = 0, have_dscr = 0;
ce65b8
   int tdesc_wordsize = -1;
ce65b8
   const struct target_desc *tdesc = info.target_desc;
ce65b8
   struct tdesc_arch_data *tdesc_data = NULL;
ce65b8
@@ -6129,6 +6149,44 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
ce65b8
 	}
ce65b8
       else
ce65b8
 	have_spe = 0;
ce65b8
+
ce65b8
+      /* Program Priority Register.  */
ce65b8
+      feature = tdesc_find_feature (tdesc,
ce65b8
+				    "org.gnu.gdb.power.ppr");
ce65b8
+      if (feature != NULL)
ce65b8
+	{
ce65b8
+	  valid_p = 1;
ce65b8
+	  valid_p &= tdesc_numbered_register (feature, tdesc_data,
ce65b8
+					      PPC_PPR_REGNUM, "ppr");
ce65b8
+
ce65b8
+	  if (!valid_p)
ce65b8
+	    {
ce65b8
+	      tdesc_data_cleanup (tdesc_data);
ce65b8
+	      return NULL;
ce65b8
+	    }
ce65b8
+	  have_ppr = 1;
ce65b8
+	}
ce65b8
+      else
ce65b8
+	have_ppr = 0;
ce65b8
+
ce65b8
+      /* Data Stream Control Register.  */
ce65b8
+      feature = tdesc_find_feature (tdesc,
ce65b8
+				    "org.gnu.gdb.power.dscr");
ce65b8
+      if (feature != NULL)
ce65b8
+	{
ce65b8
+	  valid_p = 1;
ce65b8
+	  valid_p &= tdesc_numbered_register (feature, tdesc_data,
ce65b8
+					      PPC_DSCR_REGNUM, "dscr");
ce65b8
+
ce65b8
+	  if (!valid_p)
ce65b8
+	    {
ce65b8
+	      tdesc_data_cleanup (tdesc_data);
ce65b8
+	      return NULL;
ce65b8
+	    }
ce65b8
+	  have_dscr = 1;
ce65b8
+	}
ce65b8
+      else
ce65b8
+	have_dscr = 0;
ce65b8
     }
ce65b8
 
ce65b8
   /* If we have a 64-bit binary on a 32-bit target, complain.  Also
ce65b8
@@ -6323,6 +6381,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
ce65b8
   tdep->ppc_ev0_upper_regnum = have_spe ? PPC_SPE_UPPER_GP0_REGNUM : -1;
ce65b8
   tdep->ppc_acc_regnum = have_spe ? PPC_SPE_ACC_REGNUM : -1;
ce65b8
   tdep->ppc_spefscr_regnum = have_spe ? PPC_SPE_FSCR_REGNUM : -1;
ce65b8
+  tdep->ppc_ppr_regnum = have_ppr ? PPC_PPR_REGNUM : -1;
ce65b8
+  tdep->ppc_dscr_regnum = have_dscr ? PPC_DSCR_REGNUM : -1;
ce65b8
 
ce65b8
   set_gdbarch_pc_regnum (gdbarch, PPC_PC_REGNUM);
ce65b8
   set_gdbarch_sp_regnum (gdbarch, PPC_R0_REGNUM + 1);
ce65b8
diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c
ce65b8
@@ -0,0 +1,34 @@
ce65b8
+/* This testcase is part of GDB, the GNU debugger.
ce65b8
+
ce65b8
+   Copyright (C) 2018 Free Software Foundation, Inc.
ce65b8
+
ce65b8
+   This program is free software; you can redistribute it and/or modify
ce65b8
+   it under the terms of the GNU General Public License as published by
ce65b8
+   the Free Software Foundation; either version 3 of the License, or
ce65b8
+   (at your option) any later version.
ce65b8
+
ce65b8
+   This program is distributed in the hope that it will be useful,
ce65b8
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce65b8
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ce65b8
+   GNU General Public License for more details.
ce65b8
+
ce65b8
+   You should have received a copy of the GNU General Public License
ce65b8
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
ce65b8
+
ce65b8
+int main (void)
ce65b8
+{
ce65b8
+  /* Set Load Stream Disable bit in DSCR.  */
ce65b8
+  unsigned long dscr = 0x20;
ce65b8
+
ce65b8
+  /* This is the non-privileged SPR number to access DSCR,
ce65b8
+     available since isa 207.  */
ce65b8
+  asm volatile ("mtspr 3,%0" : : "r" (dscr));
ce65b8
+
ce65b8
+  /* Set PPR to low priority (010 in bits 11:13, or
ce65b8
+     0x0008000000000000).  */
ce65b8
+  asm volatile ("or 1,1,1");
ce65b8
+  asm volatile ("nop"); // marker
ce65b8
+  asm volatile ("nop");
ce65b8
+
ce65b8
+  return 0;
ce65b8
+}
ce65b8
diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
ce65b8
new file mode 100644
ce65b8
--- /dev/null
ce65b8
+++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
ce65b8
@@ -0,0 +1,120 @@
ce65b8
+# Copyright (C) 2018 Free Software Foundation, Inc.
ce65b8
+
ce65b8
+# This program is free software; you can redistribute it and/or modify
ce65b8
+# it under the terms of the GNU General Public License as published by
ce65b8
+# the Free Software Foundation; either version 3 of the License, or
ce65b8
+# (at your option) any later version.
ce65b8
+#
ce65b8
+# This program is distributed in the hope that it will be useful,
ce65b8
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
ce65b8
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ce65b8
+# GNU General Public License for more details.
ce65b8
+#
ce65b8
+# You should have received a copy of the GNU General Public License
ce65b8
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
ce65b8
+
ce65b8
+# This file is part of the gdb testsuite.
ce65b8
+
ce65b8
+# Test access to special purpose registers PPR and DSCR.  The test
ce65b8
+# inferior writes to these registers, we check that GDB reads the same
ce65b8
+# values, then write to the registers trough GDB, step once, and check
ce65b8
+# again if we read back the same values.
ce65b8
+
ce65b8
+if {![istarget "powerpc*-*-linux*"]} then {
ce65b8
+    verbose "Skipping PowerPC test for PPR and DSCR registers."
ce65b8
+    return
ce65b8
+}
ce65b8
+
ce65b8
+standard_testfile .c
ce65b8
+
ce65b8
+if {[build_executable "compile" $binfile $srcfile {debug}] == -1} {
ce65b8
+    return
ce65b8
+}
ce65b8
+
ce65b8
+proc check_register_access { regname } {
ce65b8
+    global gdb_prompt
ce65b8
+
ce65b8
+    set test "$regname register access"
ce65b8
+    gdb_test_multiple "info reg $regname" "$test" {
ce65b8
+	-re "Invalid register.*\r\n$gdb_prompt $" {
ce65b8
+	    unsupported "$test"
ce65b8
+	    return 0
ce65b8
+	}
ce65b8
+	-re "\r\n$regname.*\r\n$gdb_prompt $" {
ce65b8
+	    pass "$test"
ce65b8
+	    return 1
ce65b8
+	}
ce65b8
+    }
ce65b8
+    return 0
ce65b8
+}
ce65b8
+
ce65b8
+# Do one pass to check if the instructions in our test programs are
ce65b8
+# available to this processor (e.g. mtspr 3, RS for accessing DSCR).
ce65b8
+proc ppr_dscr_available {} {
ce65b8
+    global gdb_prompt
ce65b8
+    global inferior_exited_re
ce65b8
+
ce65b8
+    set test "PPR/DSCR available to inferior"
ce65b8
+    gdb_test_multiple "continue" "" {
ce65b8
+	-re "Illegal instruction.*\r\n$gdb_prompt $" {
ce65b8
+	    unsupported "$test"
ce65b8
+	    return 0
ce65b8
+	}
ce65b8
+	-re "$inferior_exited_re normally.*$gdb_prompt $" {
ce65b8
+	    pass "$test"
ce65b8
+	    return 1
ce65b8
+	}
ce65b8
+    }
ce65b8
+    return 0
ce65b8
+}
ce65b8
+
ce65b8
+with_test_prefix "check PPR/DSCR access" {
ce65b8
+    clean_restart $binfile
ce65b8
+
ce65b8
+    if ![runto_main] {
ce65b8
+	return
ce65b8
+    }
ce65b8
+
ce65b8
+    if {![check_register_access "ppr"]} {
ce65b8
+	return
ce65b8
+    }
ce65b8
+
ce65b8
+    if {![check_register_access "dscr"]} {
ce65b8
+	return
ce65b8
+    }
ce65b8
+
ce65b8
+    if {![ppr_dscr_available]} {
ce65b8
+	return
ce65b8
+    }
ce65b8
+}
ce65b8
+
ce65b8
+# Now do the actual test
ce65b8
+clean_restart $binfile
ce65b8
+
ce65b8
+if ![runto_main] {
ce65b8
+    return
ce65b8
+}
ce65b8
+
ce65b8
+gdb_breakpoint [gdb_get_line_number "marker"]
ce65b8
+
ce65b8
+gdb_continue_to_breakpoint "continue to marker"
ce65b8
+
ce65b8
+# At the breakpoint the inferior should have set the
ce65b8
+# registers to these expected values.
ce65b8
+
ce65b8
+with_test_prefix "before write" {
ce65b8
+    gdb_test "info reg dscr" "dscr.*0x0*20\[ \t\]+.*"
ce65b8
+    gdb_test "info reg ppr" "ppr.*0x0*8000000000000\[ \t\]+.*"
ce65b8
+}
ce65b8
+
ce65b8
+# Set Store Stream Enable in DSCR and set PPR to the medium-low
ce65b8
+# priority.
ce65b8
+gdb_test_no_output "set \$dscr = 0x8"
ce65b8
+gdb_test_no_output "set \$ppr = 0xC000000000000"
ce65b8
+
ce65b8
+gdb_test "stepi" "asm.*"
ce65b8
+
ce65b8
+with_test_prefix "after write" {
ce65b8
+    gdb_test "info reg dscr" "dscr.*0x0*8+\[ \t\]+.*"
ce65b8
+    gdb_test "info reg ppr" "ppr.*0x0*\[cC\]000000000000\[ \t\]+.*"
ce65b8
+}