4 ms·
It also uses the int 0x80 interface instead of the faster sysenter opcode. (AMD calls this opcode syscall.) http://wiki.osdev.org/SYSENTER http://wiki.osdev.or
by cbd1984 11y ago
It also uses the int 0x80 interface instead of the faster sysenter opcode. (AMD calls this opcode syscall.)
http://wiki.osdev.org/SYSENTER http://wiki.osdev.org/SYSENTER
I say "faster" above, and that's true for all chips since the Pentium 4, if not earlier, but it isn't true on all 32-bit x86 chips. It isn't even true on all 32-bit x86 chips which have the opcode. So the Linux kernel has a special trick such that all binaries always use the fastest syscall method, regardless of which kind of system they were compiled for: linux-gate.so.1 also known as linux-vdso.so.1
This isn't actually a file on disk, it's just some machine code the kernel maps into the process address space which syscalls indirect through, because the kernel knows more about the hardware than applications.
http://www.trilithium.com/johan/2005/08/linux-gate/ http://www.trilithium.com/johan/2005/08/linux-gate/
vDSO even stands for virtual Dynamic Shared Object:
http://man7.org/linux/man-pages/man7/vdso.7.html http://man7.org/linux/man-pages/man7/vdso.7.html
Aside from being virtual, it's a normal ELF shared object, with symbol names and versoning and the functions use the normal C calling convention.
- 2ton_jeff 11y agoOn my list of things to do is to write an article titled "VDSO and why you should care." Interestingly, syscall indirection isn't among my reasons (maybe I am too comfortable in my SSE2+ x86_64 environment). If anyone is interested, the magic all lives in /proc/self/auxv, and my own library implementation to hook gettimeofday can be perused at: https://2ton.com.au/library_as_html/vdso.inc.html https://2ton.com.au/library_as_html/vdso.inc.html