From: Philippe Waroquiers Date: Thu, 31 Jul 2014 19:44:24 +0000 (+0000) Subject: take endianness into account in arm64 fpsr xfer, X-Git-Tag: svn/VALGRIND_3_10_0~230 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0d94ea992393d2fba7298ff5a2af9e1c8ab09ae9;p=thirdparty%2Fvalgrind.git 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 --- diff --git a/coregrind/m_gdbserver/remote-utils.c b/coregrind/m_gdbserver/remote-utils.c index 3b23600eee..599919cc51 100644 --- a/coregrind/m_gdbserver/remote-utils.c +++ b/coregrind/m_gdbserver/remote-utils.c @@ -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) diff --git a/coregrind/m_gdbserver/valgrind-low-arm64.c b/coregrind/m_gdbserver/valgrind-low-arm64.c index 5a32ef87ca..f701f4b020 100644 --- a/coregrind/m_gdbserver/valgrind-low-arm64.c +++ b/coregrind/m_gdbserver/valgrind-low-arm64.c @@ -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;