|
From: <sv...@va...> - 2012-02-09 11:58:51
|
Author: tom
Date: 2012-02-09 11:54:16 +0000 (Thu, 09 Feb 2012)
New Revision: 12372
Log:
Implement the getcpu vsyscall on amd64 by forwarding it to the real
system call. Patch from L?\195?\169na?\195?\175c Huard to fix BZ#187043.
Modified:
trunk/coregrind/m_redir.c
trunk/coregrind/m_trampoline.S
trunk/coregrind/pub_core_trampoline.h
Modified: trunk/coregrind/m_redir.c
===================================================================
--- trunk/coregrind/m_redir.c 2012-02-09 11:48:28 UTC (rev 12371)
+++ trunk/coregrind/m_redir.c 2012-02-09 11:54:16 UTC (rev 12372)
@@ -731,6 +731,7 @@
# if defined(VGP_amd64_linux)
&& act.from_addr != 0xFFFFFFFFFF600000ULL
&& act.from_addr != 0xFFFFFFFFFF600400ULL
+ && act.from_addr != 0xFFFFFFFFFF600800ULL
# endif
) {
what = "redirection from-address is in non-executable area";
@@ -1089,12 +1090,16 @@
/* Redirect vsyscalls to local versions */
add_hardwired_active(
0xFFFFFFFFFF600000ULL,
- (Addr)&VG_(amd64_linux_REDIR_FOR_vgettimeofday)
+ (Addr)&VG_(amd64_linux_REDIR_FOR_vgettimeofday)
);
- add_hardwired_active(
+ add_hardwired_active(
0xFFFFFFFFFF600400ULL,
- (Addr)&VG_(amd64_linux_REDIR_FOR_vtime)
+ (Addr)&VG_(amd64_linux_REDIR_FOR_vtime)
);
+ add_hardwired_active(
+ 0xFFFFFFFFFF600800ULL,
+ (Addr)&VG_(amd64_linux_REDIR_FOR_vgetcpu)
+ );
/* If we're using memcheck, use these intercepts right from
the start, otherwise ld.so makes a lot of noise. */
Modified: trunk/coregrind/m_trampoline.S
===================================================================
--- trunk/coregrind/m_trampoline.S 2012-02-09 11:48:28 UTC (rev 12371)
+++ trunk/coregrind/m_trampoline.S 2012-02-09 11:54:16 UTC (rev 12372)
@@ -189,6 +189,16 @@
.LfnE3:
.size VG_(amd64_linux_REDIR_FOR_vtime), .-.LfnB3
+.global VG_(amd64_linux_REDIR_FOR_vgetcpu)
+.type VG_(amd64_linux_REDIR_FOR_vgetcpu), @function
+VG_(amd64_linux_REDIR_FOR_vgetcpu):
+.LfnB4:
+ movq $__NR_getcpu, %rax
+ syscall
+ ret
+.LfnE4:
+.size VG_(amd64_linux_REDIR_FOR_vgetcpu), .-.LfnB4
+
/* There's no particular reason that this needs to be handwritten
assembly, but since that's what this file contains, here's a
simple strlen implementation (written in C and compiled by gcc.)
@@ -196,7 +206,7 @@
.global VG_(amd64_linux_REDIR_FOR_strlen)
.type VG_(amd64_linux_REDIR_FOR_strlen), @function
VG_(amd64_linux_REDIR_FOR_strlen):
-.LfnB4:
+.LfnB5:
xorl %eax, %eax
cmpb $0, (%rdi)
movq %rdi, %rdx
@@ -207,11 +217,11 @@
movq %rdx, %rax
subq %rdi, %rax
.L41: ret
-.LfnE4:
+.LfnE5:
.size VG_(amd64_linux_REDIR_FOR_strlen), .-VG_(amd64_linux_REDIR_FOR_strlen)
-/* A CIE for the above three functions, followed by their FDEs */
+/* A CIE for the above four functions, followed by their FDEs */
.section .eh_frame,"a",@progbits
.Lframe1:
.long .LEcie1-.LScie1
@@ -258,6 +268,15 @@
.uleb128 0x0
.align 8
.LEfde4:
+.LSfde5:
+ .long .LEfde5-.LASfde5
+.LASfde5:
+ .long .LASfde5-.Lframe1
+ .long .LfnB5
+ .long .LfnE5-.LfnB5
+ .uleb128 0x0
+ .align 8
+.LEfde5:
.previous
.global VG_(trampoline_stuff_end)
Modified: trunk/coregrind/pub_core_trampoline.h
===================================================================
--- trunk/coregrind/pub_core_trampoline.h 2012-02-09 11:48:28 UTC (rev 12371)
+++ trunk/coregrind/pub_core_trampoline.h 2012-02-09 11:54:16 UTC (rev 12372)
@@ -67,6 +67,7 @@
extern Addr VG_(amd64_linux_SUBST_FOR_rt_sigreturn);
extern Addr VG_(amd64_linux_REDIR_FOR_vgettimeofday);
extern Addr VG_(amd64_linux_REDIR_FOR_vtime);
+extern Addr VG_(amd64_linux_REDIR_FOR_vgetcpu);
extern UInt VG_(amd64_linux_REDIR_FOR_strlen)( void* );
#endif
|