]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
take endianness into account in arm64 fpsr xfer,
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 31 Jul 2014 19:44:24 +0000 (19:44 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 31 Jul 2014 19:44:24 +0000 (19:44 +0000)
use VKI_LITTLE_ENDIAN to decide to reverse or not bytes in image function

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14223

coregrind/m_gdbserver/remote-utils.c
coregrind/m_gdbserver/valgrind-low-arm64.c

index 3b23600eeea2569d6cd375784904d9ad9e215fff..599919cc51f226453df377f2a061f20528ee30f4 100644 (file)
@@ -657,17 +657,17 @@ int hexify (char *hex, const char *bin, int count)
    Useful for register and int image */
 char* heximage (char *buf, char *bin, int count)
 {
-#if defined(VGA_x86) || defined(VGA_amd64)
+#if (VKI_LITTLE_ENDIAN)
    char rev[count]; 
    /* note: no need for trailing \0, length is known with count */
-  int i;
-  for (i = 0; i < count; i++)
-    rev[i] = bin[count - i - 1];
-  hexify (buf, rev, count);
+   int i;
+   for (i = 0; i < count; i++)
+      rev[i] = bin[count - i - 1];
+   hexify (buf, rev, count);
 #else
-  hexify (buf, bin, count);
+   hexify (buf, bin, count);
 #endif
-  return buf;
+   return buf;
 }
 
 void* C2v(CORE_ADDR addr)
index 5a32ef87caaad78358e27426860eeeb3f14a9a4c..f701f4b020fe95edcc92ddeb5b69441db48efbf4 100644 (file)
@@ -222,15 +222,15 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
           architecturally defined representation.  Hence use conversion
           functions to convert to/from it.
           VEX FPSR only models QC (bit 27), and uses a 64 bits to store
-          this FPSR QC bit. So, we need to transfer from/to the lowest part
-          of the ULong that VEX provides/needs, as GDB expects or
-          gives only 4 bytes. */
+          this FPSR QC bit. So, we need to transfer from/to the lowest
+          significant part of the ULong that VEX provides/needs,
+          as GDB expects or gives only 4 bytes. */
       if (dir == valgrind_to_gdbserver) {
          ULong fpsr = LibVEX_GuestARM64_get_fpsr(arm);
-         VG_(transfer) ((UInt*)&fpsr + 1, buf, dir, size, mod);
+         VG_(transfer) ((UInt*)&fpsr, buf, dir, size, mod);
       } else {
          ULong fpsr = 0;
-         VG_(transfer) ((UInt*)&fpsr + 1, buf, dir, size, mod);
+         VG_(transfer) ((UInt*)&fpsr, buf, dir, size, mod);
          LibVEX_GuestARM64_set_fpsr(arm, fpsr);
       }
       break;