Blame SOURCES/gdb-rhbz1125820-ppc64le-enablement-26of37.patch

7ab123
commit 084ee54552f6c35d740e8b9bc81a4fe8d8bb178b
7ab123
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
7ab123
Date:   Tue Feb 4 18:31:38 2014 +0100
7ab123
7ab123
    PowerPC64 little-endian fixes: VSX tests and pseudo-regs
7ab123
    
7ab123
    Many VSX test were failing on powerpc64le-linux, since -as opposed to the
7ab123
    AltiVec tests- there never were little-endian versions of the test patterns.
7ab123
    
7ab123
    This patch adds such patterns, along the lines of altivec-regs.exp.
7ab123
    
7ab123
    In addition, there is an actual code change required: For those VSX
7ab123
    registers that overlap a floating-point register, the FP register
7ab123
    overlaps the most-significant half of the VSX register both on big-
7ab123
    and little-endian systems.  However, on little-endian systems, that
7ab123
    half is stored at an offset of 8 bytes (not 0).  This works already
7ab123
    for the "real" FP registers, but current code gets it wrong for
7ab123
    the "extended" pseudo FP register GDB generates for the second
7ab123
    half of the VSX register bank.
7ab123
    
7ab123
    This patch updates the corresponding pseudo read/write routines
7ab123
    to take the appropriate offset into consideration.
7ab123
    
7ab123
    gdb/ChangeLog:
7ab123
    
7ab123
    	* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
7ab123
    	of the overlapped FP register within the VSX register on little-
7ab123
    	endian platforms.
7ab123
    	(efpr_pseudo_register_write): Likewise.
7ab123
    
7ab123
    gdb/testsuite/ChangeLog:
7ab123
    
7ab123
    	* gdb.arch/vsx-regs.exp: Check target endianness.  Provide variants
7ab123
    	of the test patterns for use on little-endian systems.
7ab123
7ab123
Index: gdb-7.6.1/gdb/rs6000-tdep.c
7ab123
===================================================================
7ab123
--- gdb-7.6.1.orig/gdb/rs6000-tdep.c
7ab123
+++ gdb-7.6.1/gdb/rs6000-tdep.c
7ab123
@@ -2830,10 +2830,12 @@ efpr_pseudo_register_read (struct gdbarc
7ab123
 {
7ab123
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7ab123
   int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
7ab123
+  int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
7ab123
 
7ab123
   /* Read the portion that overlaps the VMX register.  */
7ab123
-  return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
7ab123
-				 register_size (gdbarch, reg_nr), buffer);
7ab123
+  return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index,
7ab123
+				 offset, register_size (gdbarch, reg_nr),
7ab123
+				 buffer);
7ab123
 }
7ab123
 
7ab123
 /* Write method for POWER7 Extended FP pseudo-registers.  */
7ab123
@@ -2843,10 +2845,12 @@ efpr_pseudo_register_write (struct gdbar
7ab123
 {
7ab123
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7ab123
   int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
7ab123
+  int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
7ab123
 
7ab123
   /* Write the portion that overlaps the VMX register.  */
7ab123
-  regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
7ab123
-			   register_size (gdbarch, reg_nr), buffer);
7ab123
+  regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index,
7ab123
+			   offset, register_size (gdbarch, reg_nr),
7ab123
+			   buffer);
7ab123
 }
7ab123
 
7ab123
 static enum register_status
7ab123
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/vsx-regs.exp
7ab123
===================================================================
7ab123
--- gdb-7.6.1.orig/gdb/testsuite/gdb.arch/vsx-regs.exp
7ab123
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/vsx-regs.exp
7ab123
@@ -58,19 +58,45 @@ if ![runto_main] then {
7ab123
     gdb_suppress_tests
7ab123
 }
7ab123
 
7ab123
+set endianness ""
7ab123
+set msg "detect endianness"
7ab123
+gdb_test_multiple "show endian" "$msg" {
7ab123
+    -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
7ab123
+        pass "$msg"
7ab123
+        set endianness $expect_out(2,string)
7ab123
+    }
7ab123
+    -re ".*$gdb_prompt $" {
7ab123
+        fail "$msg"
7ab123
+    }
7ab123
+}
7ab123
+
7ab123
 # Data sets used throughout the test
7ab123
 
7ab123
-set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.."
7ab123
+if {$endianness == "big"} {
7ab123
+    set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.."
7ab123
+
7ab123
+    set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
7ab123
+
7ab123
+    set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
7ab123
 
7ab123
-set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
7ab123
+    set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
7ab123
 
7ab123
-set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
7ab123
+    set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
7ab123
 
7ab123
-set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
7ab123
+    set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
7ab123
+} else {
7ab123
+    set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x0, 0x1., v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x0, 0x0, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
7ab123
 
7ab123
-set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
7ab123
+    set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x1, 0x1, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
7ab123
 
7ab123
-set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
7ab123
+    set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
7ab123
+
7ab123
+    set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
7ab123
+
7ab123
+    set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
7ab123
+
7ab123
+    set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
7ab123
+}
7ab123
 
7ab123
 set float_register ".raw 0xdeadbeefdeadbeef."
7ab123