]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
arm64 Improve fpsr gdbsrv handling.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 10 Aug 2014 10:42:10 +0000 (10:42 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 10 Aug 2014 10:42:10 +0000 (10:42 +0000)
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;
  }

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

coregrind/m_gdbserver/valgrind-low-arm64.c

index ff65378defafd4d41dc6ae059aa8820bc539993f..32f19e17464fdca5bdf5f8b6e1a924f411505e77 100644 (file)
@@ -226,15 +226,19 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
           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;
    }