mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Initial redirect stuff for ppc64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5499
This commit is contained in:
parent
c70190e6da
commit
9c0ae4be6f
@ -2398,8 +2398,12 @@ Int main(Int argc, HChar **argv, HChar **envp)
|
||||
// p: aspacem
|
||||
//--------------------------------------------------------------
|
||||
{ Bool change_ownership_v_c_OK;
|
||||
Addr co_start = VG_PGROUNDDN( (Addr)&VG_(trampoline_stuff_start) );
|
||||
Addr co_endPlus = VG_PGROUNDUP( (Addr)&VG_(trampoline_stuff_end) );
|
||||
Addr co_start = VG_PGROUNDDN(
|
||||
(Addr)VG_(fnptr_to_fnentry)(
|
||||
&VG_(trampoline_stuff_start) ) );
|
||||
Addr co_endPlus = VG_PGROUNDUP(
|
||||
(Addr)VG_(fnptr_to_fnentry)(
|
||||
&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 );
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
@ -406,7 +407,16 @@ void VG_(setup_code_redirect_table) ( void )
|
||||
|
||||
#elif defined(VGP_ppc64_linux)
|
||||
|
||||
// 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==VG_(strcmp)("Memcheck", VG_(details).name)) {
|
||||
|
||||
add_redirect_sym_to_addr(
|
||||
"soname:ld64.so.1", "strlen",
|
||||
(Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strlen) )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
# error Unknown platform
|
||||
|
||||
@ -277,6 +277,9 @@ VG_(ppc32_linux_REDIR_FOR_strchr):
|
||||
.global VG_(trampoline_stuff_end)
|
||||
VG_(trampoline_stuff_end):
|
||||
|
||||
/* and a trailing page of unexecutable code */
|
||||
UD2_PAGE
|
||||
|
||||
# undef UD2_16
|
||||
# undef UD2_64
|
||||
# undef UD2_256
|
||||
@ -306,7 +309,32 @@ VG_(trampoline_stuff_start):
|
||||
.type .VG_(trampoline_stuff_start),@function
|
||||
.global .VG_(trampoline_stuff_start)
|
||||
.VG_(trampoline_stuff_start):
|
||||
|
||||
|
||||
.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_REDIR_FOR_strlen)
|
||||
|
||||
.align 2
|
||||
.global VG_(trampoline_stuff_end)
|
||||
@ -319,6 +347,9 @@ VG_(trampoline_stuff_end):
|
||||
.global .VG_(trampoline_stuff_end)
|
||||
.VG_(trampoline_stuff_end):
|
||||
|
||||
/* and a trailing page of unexecutable code */
|
||||
UD2_PAGE
|
||||
|
||||
# undef UD2_16
|
||||
# undef UD2_64
|
||||
# undef UD2_256
|
||||
|
||||
@ -65,6 +65,10 @@ extern UInt VG_(ppc32_linux_REDIR_FOR_strlen)( void* );
|
||||
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
|
||||
|
||||
#endif // __PUB_CORE_TRAMPOLINE_H
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user