|
From: <sv...@va...> - 2014-08-10 10:42:17
|
Author: philippe
Date: Sun Aug 10 10:42:10 2014
New Revision: 14256
Log:
arm64 Improve fpsr gdbsrv handling.
let the compiler handle the ULong to UInt conversion rather than
play with addresses.
Tested manually GDB+vgdb that reading and setting fpsr works, using
code such as (provided by Julian, I cannot write a single line of
arm64 asm :)
void set_fpsr ( uint32_t val ) {
__asm__ __volatile__( "msr fpsr, %0" : : "r"(val) : "cc" );
}
uint32_t get_fpsr ( void ) {
uint32_t res;
__asm__ __volatile__( "mrs %0, fpsr" : "=r"(res) : : "cc" );
return res;
}
Modified:
trunk/coregrind/m_gdbserver/valgrind-low-arm64.c
Modified: trunk/coregrind/m_gdbserver/valgrind-low-arm64.c
==============================================================================
--- trunk/coregrind/m_gdbserver/valgrind-low-arm64.c (original)
+++ trunk/coregrind/m_gdbserver/valgrind-low-arm64.c Sun Aug 10 10:42:10 2014
@@ -226,15 +226,19 @@
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, buf, dir, size, mod);
+ ULong fpsr64 = LibVEX_GuestARM64_get_fpsr(arm);
+ UInt fpsr = (UInt)fpsr64;
+ VG_(transfer) (&fpsr, buf, dir, size, mod);
} else {
- ULong fpsr = 0;
+ UInt fpsr;
+ ULong fpsr64;
VG_(transfer) ((UInt*)&fpsr, buf, dir, size, mod);
- LibVEX_GuestARM64_set_fpsr(arm, fpsr);
+ fpsr64 = fpsr;
+ LibVEX_GuestARM64_set_fpsr(arm, fpsr64);
/* resync the cache with the part of fpsr that VEX represents. */
- fpsr = LibVEX_GuestARM64_get_fpsr(arm);
- VG_(transfer) ((UInt*)&fpsr, buf, valgrind_to_gdbserver, size, mod);
+ fpsr64 = LibVEX_GuestARM64_get_fpsr(arm);
+ fpsr = (UInt)fpsr64;
+ VG_(transfer) (&fpsr, buf, valgrind_to_gdbserver, size, mod);
}
break;
}
|