Subject: COMPAT_LINUX vsyscall
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 05/01/2005 10:46:02
Hi

Working on COMPAT_LINUX, I discovered a new Linux feature (kernel
2.6.11.1) called the vsyscall page. This is similar to Darwin's
commpage: a page of functions mapped by the kernel in userspace:

Here is pmap output when stopped by a breakpoint after the program
first's instruction:
0000000000400000    436K r-x--  /home/manu/tests/hello
000000000056c000     40K rw---  /home/manu/tests/hello
0000000000576000      8K rw---    [ anon ]
00007ffffffeb000     84K rw---    [ stack ]
ffffffffff600000   8192K -----    [ anon ] 

If I disasseble the first bytes, it looks like a gettimeofday() system
call (on Linux/amd64, syscall 0x60 is gettimeofday)
0xffffffffff600000:     mov    426(%rip),%eax
0xffffffffff600006:     push   %rbx
0xffffffffff600007:     test   %eax,%eax
0xffffffffff600009:     jne    0xffffffffff600017
0xffffffffff60000b:     mov    $0x60,%eax
0xffffffffff600010:     syscall 
(...)

Someone already had a look at it? I'd like to not rediscover the wheel
by groveling in Linux sources.

-- 
Emmanuel Dreyfus
Le cahier de l'admin BSD 2eme ed. est dans toutes les bonnes librairies
http://www.eyrolles.com/Informatique/Livre/9782212114638/livre-bsd.php
manu@netbsd.org