take endianness into account in arm64 fpsr xfer,
use VKI_LITTLE_ENDIAN to decide to reverse or not bytes in image function
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14223 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_gdbserver/remote-utils.c b/coregrind/m_gdbserver/remote-utils.c
index 3b23600..599919c 100644
--- a/coregrind/m_gdbserver/remote-utils.c
+++ b/coregrind/m_gdbserver/remote-utils.c
@@ -657,17 +657,17 @@
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)
diff --git a/coregrind/m_gdbserver/valgrind-low-arm64.c b/coregrind/m_gdbserver/valgrind-low-arm64.c
index 5a32ef8..f701f4b 100644
--- a/coregrind/m_gdbserver/valgrind-low-arm64.c
+++ b/coregrind/m_gdbserver/valgrind-low-arm64.c
@@ -222,15 +222,15 @@
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;