Quantcast

Valgrind: r16212 - in /trunk/coregrind/m_gdbserver: valgrind-low-mips32.c valgrind-low-mips64.c

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Valgrind: r16212 - in /trunk/coregrind/m_gdbserver: valgrind-low-mips32.c valgrind-low-mips64.c

svn-2
Author: petarj
Date: Fri Jan 27 17:55:13 2017
New Revision: 16212

Log:
mips: fix target_get_drv() function

Return correct Dtv location. Top of MIPS tcbhead structure is located
0x7000 bytes before the value of ULR. Dtv is the first of two pointers
in the tcbhead structure.

This fixes gdbserver_tests/hgtls on some MIPS platforms.

Modified:
    trunk/coregrind/m_gdbserver/valgrind-low-mips32.c
    trunk/coregrind/m_gdbserver/valgrind-low-mips64.c

Modified: trunk/coregrind/m_gdbserver/valgrind-low-mips32.c
==============================================================================
--- trunk/coregrind/m_gdbserver/valgrind-low-mips32.c (original)
+++ trunk/coregrind/m_gdbserver/valgrind-low-mips32.c Fri Jan 27 17:55:13 2017
@@ -356,9 +356,11 @@
 static CORE_ADDR** target_get_dtv (ThreadState *tst)
 {
    VexGuestMIPS32State* mips32 = (VexGuestMIPS32State*)&tst->arch.vex;
-   // mips32 dtv location similar to ppc64
-   return (CORE_ADDR**)((CORE_ADDR)mips32->guest_ULR
-                        - 0x7000 - sizeof(CORE_ADDR));
+   // Top of MIPS tcbhead structure is located 0x7000 bytes before the value
+   // of ULR. Dtv is the first of two pointers in tcbhead structure.
+   // More details can be found in GLIBC/sysdeps/nptl/tls.h.
+   return (CORE_ADDR**)((CORE_ADDR)mips32->guest_ULR
+                        - 0x7000 - 2 * sizeof(CORE_ADDR));
 }
 
 static struct valgrind_target_ops low_target = {

Modified: trunk/coregrind/m_gdbserver/valgrind-low-mips64.c
==============================================================================
--- trunk/coregrind/m_gdbserver/valgrind-low-mips64.c (original)
+++ trunk/coregrind/m_gdbserver/valgrind-low-mips64.c Fri Jan 27 17:55:13 2017
@@ -357,9 +357,11 @@
 static CORE_ADDR** target_get_dtv (ThreadState *tst)
 {
    VexGuestMIPS64State* mips64 = (VexGuestMIPS64State*)&tst->arch.vex;
-   // mips64 dtv location similar to ppc64
-   return (CORE_ADDR**)((CORE_ADDR)mips64->guest_ULR
-                        - 0x7000 - sizeof(CORE_ADDR));
+   // Top of MIPS tcbhead structure is located 0x7000 bytes before the value
+   // of ULR. Dtv is the first of two pointers in tcbhead structure.
+   // More details can be found in GLIBC/sysdeps/nptl/tls.h.
+   return (CORE_ADDR**)((CORE_ADDR)mips64->guest_ULR
+                        - 0x7000 - 2 * sizeof(CORE_ADDR));
 }
 
 static struct valgrind_target_ops low_target = {


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Loading...