|
From: <sv...@va...> - 2006-01-05 14:07:15
|
Author: sewardj
Date: 2006-01-05 14:07:04 +0000 (Thu, 05 Jan 2006)
New Revision: 5499
Log:
Initial redirect stuff for ppc64-linux.
Modified:
trunk/coregrind/m_main.c
trunk/coregrind/m_redir.c
trunk/coregrind/m_trampoline.S
trunk/coregrind/pub_core_trampoline.h
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2006-01-04 15:40:16 UTC (rev 5498)
+++ trunk/coregrind/m_main.c 2006-01-05 14:07:04 UTC (rev 5499)
@@ -2398,8 +2398,12 @@
// p: aspacem
//--------------------------------------------------------------
{ Bool change_ownership_v_c_OK;
- Addr co_start =3D VG_PGROUNDDN( (Addr)&VG_(trampoline_stuff_start=
) );
- Addr co_endPlus =3D VG_PGROUNDUP( (Addr)&VG_(trampoline_stuff_end) =
);
+ Addr co_start =3D VG_PGROUNDDN(=20
+ (Addr)VG_(fnptr_to_fnentry)(=20
+ &VG_(trampoline_stuff_start) ) );
+ Addr co_endPlus =3D VG_PGROUNDUP(=20
+ (Addr)VG_(fnptr_to_fnentry)(=20
+ &VG_(trampoline_stuff_end) ) );
VG_(debugLog)(1,"redir",
"transfer ownership V -> C of 0x%llx .. 0x%llx\n",
(ULong)co_start, (ULong)co_endPlus-1 );
Modified: trunk/coregrind/m_redir.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_redir.c 2006-01-04 15:40:16 UTC (rev 5498)
+++ trunk/coregrind/m_redir.c 2006-01-05 14:07:04 UTC (rev 5499)
@@ -43,6 +43,7 @@
#include "pub_core_trampoline.h"
#include "pub_core_transtab.h"
#include "pub_core_tooliface.h" // VG_(needs).malloc_replacement
+#include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
=20
=20
/*------------------------------------------------------------*/
@@ -406,8 +407,17 @@
=20
#elif defined(VGP_ppc64_linux)
=20
- // we'll have to stick some godawful hacks in here, no doubt
+ /* If we're using memcheck, use these intercepts right from
+ the start, otherwise ld.so makes a lot of noise. */
+ if (0=3D=3DVG_(strcmp)("Memcheck", VG_(details).name)) {
=20
+ add_redirect_sym_to_addr(
+ "soname:ld64.so.1", "strlen",
+ (Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strlen)=
)
+ ); =20
+
+ }
+
#else
# error Unknown platform
#endif
Modified: trunk/coregrind/m_trampoline.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_trampoline.S 2006-01-04 15:40:16 UTC (rev 5498)
+++ trunk/coregrind/m_trampoline.S 2006-01-05 14:07:04 UTC (rev 5499)
@@ -277,6 +277,9 @@
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
=20
+ /* and a trailing page of unexecutable code */
+ UD2_PAGE
+
# undef UD2_16
# undef UD2_64
# undef UD2_256
@@ -306,9 +309,34 @@
.type .VG_(trampoline_stuff_start),@function
.global .VG_(trampoline_stuff_start)
.VG_(trampoline_stuff_start):
-=09
=20
.align 2
+.globl VG_(ppc64_linux_REDIR_FOR_strlen)
+.section ".opd","aw"
+.align 3
+VG_(ppc64_linux_REDIR_FOR_strlen):
+.quad .L.VG_(ppc64_linux_REDIR_FOR_strlen),.TOC.@tocbase
+.previous
+.type VG_(ppc64_linux_REDIR_FOR_strlen), @function
+.L.VG_(ppc64_linux_REDIR_FOR_strlen):
+ mr 9,3
+ lbz 0,0(3)
+ li 3,0
+ cmpwi 7,0,0
+ beqlr 7
+ li 3,0
+.L5:
+ addi 0,3,1
+ extsw 3,0
+ lbzx 0,9,3
+ cmpwi 7,0,0
+ bne 7,.L5
+ blr
+ .long 0
+ .byte 0,0,0,0,0,0,0,0
+ .size VG_(ppc64_linux_REDIR_FOR_strlen),.-.L.VG_(ppc64_linux_R=
EDIR_FOR_strlen)
+
+.align 2
.global VG_(trampoline_stuff_end)
.section ".opd","aw"
.align 3
@@ -319,6 +347,9 @@
.global .VG_(trampoline_stuff_end)
.VG_(trampoline_stuff_end):
=20
+ /* and a trailing page of unexecutable code */
+ UD2_PAGE
+
# undef UD2_16
# undef UD2_64
# undef UD2_256
Modified: trunk/coregrind/pub_core_trampoline.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_trampoline.h 2006-01-04 15:40:16 UTC (rev 54=
98)
+++ trunk/coregrind/pub_core_trampoline.h 2006-01-05 14:07:04 UTC (rev 54=
99)
@@ -65,6 +65,10 @@
extern UInt VG_(ppc32_linux_REDIR_FOR_strcmp)( void*, void* );
extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int );
#endif
+
+#if defined(VGP_ppc64_linux)
+extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* );
+#endif
=20
#endif // __PUB_CORE_TRAMPOLINE_H
=20
|