From: Tom Hughes Date: Mon, 2 May 2005 10:28:42 +0000 (+0000) Subject: Move the replacement code for the amd64 vsyscalls into the trampoline page X-Git-Tag: svn/VALGRIND_3_0_0~727 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6a91b8ec3f246c863c17a552004f1ebdf25eac1;p=thirdparty%2Fvalgrind.git Move the replacement code for the amd64 vsyscalls into the trampoline page so that it is copied into the client space. This avoid warnings from memcheck because it doesn't think that code inside valgrind is valid. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3591 --- diff --git a/coregrind/amd64-linux/core_platform.c b/coregrind/amd64-linux/core_platform.c index 1c93ec7d5d..d420b839fb 100644 --- a/coregrind/amd64-linux/core_platform.c +++ b/coregrind/amd64-linux/core_platform.c @@ -1,28 +1,10 @@ #include "core.h" -/* Rerouted entry point for __NR_gettimeofday */ -static void amd64_linux_rerouted__vgettimeofday(void) -{ -asm( -" movq $96, %rax\n" -" syscall\n" -); -} - -/* Rerouted entry point for __NR_time */ -static void amd64_linux_rerouted__vtime(void) -{ -asm( -" movq $201, %rax\n" -" syscall\n" -); -} - void VGP_(setup_redirects)(void) { /* Redirect vsyscalls to local versions */ VG_(add_redirect_addr_to_addr)(0xFFFFFFFFFF600000ULL, - (Addr)amd64_linux_rerouted__vgettimeofday); + VG_(client_trampoline_code)+VG_(tramp_gettimeofday_offset)); VG_(add_redirect_addr_to_addr)(0xFFFFFFFFFF600400ULL, - (Addr)amd64_linux_rerouted__vtime); + VG_(client_trampoline_code)+VG_(tramp_time_offset)); } diff --git a/coregrind/amd64/helpers.S b/coregrind/amd64/helpers.S index fa1d63d7b7..a7609b1b1d 100644 --- a/coregrind/amd64/helpers.S +++ b/coregrind/amd64/helpers.S @@ -46,6 +46,8 @@ .global VG_(trampoline_code_length) .global VG_(tramp_rt_sigreturn_offset) .global VG_(tramp_syscall_offset) +.global VG_(tramp_gettimeofday_offset) +.global VG_(tramp_time_offset) VG_(trampoline_code_start): rt_sigreturn_start: @@ -58,6 +60,18 @@ rt_sigreturn_start: .align 16 syscall_start: /* unused on amd64 */ + + .align 16 +gettimeofday_start: + movq $__NR_gettimeofday, %rax + syscall + ret + + .align 16 +time_start: + movq $__NR_time, %rax + syscall + ret tramp_code_end: .data @@ -67,6 +81,10 @@ VG_(tramp_rt_sigreturn_offset): .long rt_sigreturn_start - VG_(trampoline_code_start) VG_(tramp_syscall_offset): .long syscall_start - VG_(trampoline_code_start) +VG_(tramp_gettimeofday_offset): + .long gettimeofday_start - VG_(trampoline_code_start) +VG_(tramp_time_offset): + .long time_start - VG_(trampoline_code_start) .text diff --git a/coregrind/core.h b/coregrind/core.h index 55e0bf6176..fe8d36abe2 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -1509,6 +1509,8 @@ extern const Int VG_(trampoline_code_length); extern const Int VG_(tramp_sigreturn_offset); extern const Int VG_(tramp_rt_sigreturn_offset); extern const Int VG_(tramp_syscall_offset); +extern const Int VG_(tramp_gettimeofday_offset); +extern const Int VG_(tramp_time_offset); /* --------------------------------------------------------------------- Things relating to the used tool