[RFC][PATCH] linux-2.6.4-pre1_vsyscall-gtod_B3-part3 (3/3)

From: john stultz
Date: Wed Mar 03 2004 - 19:19:05 EST


All,
This patch implements the somewhat controversial vDSO hooks for
vsyscall-gtod. This makes LD_PRELOADing or changes to glibc unnecessary,
but requires that the system have a sysenter enabled glibc to see any
performance benifit. However the LD_PRELOAD method will still work as
well with this patch. This patch depends on both vsyscall-gtod_B3-part1
and vsyscall-gtod_B3-part2.

thanks
-john

diff -Nru a/arch/i386/kernel/vsyscall-int80.S b/arch/i386/kernel/vsyscall-int80.S
--- a/arch/i386/kernel/vsyscall-int80.S Wed Mar 3 15:40:05 2004
+++ b/arch/i386/kernel/vsyscall-int80.S Wed Mar 3 15:40:05 2004
@@ -1,3 +1,6 @@
+#include <linux/config.h>
+#include <asm/unistd.h>
+#include <asm/vsyscall-gtod.h>
/*
* Code for the vsyscall page. This version uses the old int $0x80 method.
*/
@@ -7,8 +10,26 @@
.type __kernel_vsyscall,@function
__kernel_vsyscall:
.LSTART_vsyscall:
+#ifdef CONFIG_VSYSCALL_GTOD
+ cmp $__NR_gettimeofday, %eax
+ je .Lvgettimeofday
+#endif /* CONFIG_VSYSCALL_GTOD */
int $0x80
ret
+
+#ifdef CONFIG_VSYSCALL_GTOD
+/* vsyscall-gettimeofday code */
+.Lvgettimeofday:
+ pushl %edx
+ pushl %ecx
+ pushl %ebx
+ call VSYSCALL_GTOD_START
+ popl %ebx
+ popl %ecx
+ popl %edx
+ ret
+#endif /* CONFIG_VSYSCALL_GTOD */
+
.LEND_vsyscall:
.size __kernel_vsyscall,.-.LSTART_vsyscall
.previous
diff -Nru a/arch/i386/kernel/vsyscall-sysenter.S b/arch/i386/kernel/vsyscall-sysenter.S
--- a/arch/i386/kernel/vsyscall-sysenter.S Wed Mar 3 15:40:05 2004
+++ b/arch/i386/kernel/vsyscall-sysenter.S Wed Mar 3 15:40:05 2004
@@ -1,3 +1,6 @@
+#include <linux/config.h>
+#include <asm/unistd.h>
+#include <asm/vsyscall-gtod.h>
/*
* Code for the vsyscall page. This version uses the sysenter instruction.
*/
@@ -7,6 +10,10 @@
.type __kernel_vsyscall,@function
__kernel_vsyscall:
.LSTART_vsyscall:
+#ifdef CONFIG_VSYSCALL_GTOD
+ cmp $__NR_gettimeofday, %eax
+ je .Lvgettimeofday
+#endif /* CONFIG_VSYSCALL_GTOD */
push %ecx
.Lpush_ecx:
push %edx
@@ -31,6 +38,20 @@
pop %ecx
.Lpop_ecx:
ret
+
+#ifdef CONFIG_VSYSCALL_GTOD
+/* vsyscall-gettimeofday code */
+.Lvgettimeofday:
+ pushl %edx
+ pushl %ecx
+ pushl %ebx
+ call VSYSCALL_GTOD_START
+ popl %ebx
+ popl %ecx
+ popl %edx
+ ret
+#endif /* CONFIG_VSYSCALL_GTOD */
+
.LEND_vsyscall:
.size __kernel_vsyscall,.-.LSTART_vsyscall
.previous


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/