Subject: Re: COMPAT_LINUX vsyscall
To: David Laight <firstname.lastname@example.org>
From: Jonathan Stone <email@example.com>
Date: 05/01/2005 14:50:06
In message <20050501192446.GM5984@snowdrop.l8s.co.uk>,
David Laight writes:
>On Sun, May 01, 2005 at 12:21:42PM -0400, Christos Zoulas wrote:
>> In article <1gvvpbx.qbr351ckyzb3Mfirstname.lastname@example.org>,
>> Emmanuel Dreyfus <email@example.com> wrote:
>> >Working on COMPAT_LINUX, I discovered a new Linux feature (kernel
>> >18.104.22.168) called the vsyscall page. This is similar to Darwin's
>> >commpage: a page of functions mapped by the kernel in userspace:
>Why would you want to map a page of code into userspace?
So the kernel has somewhere safe to put useful kernel-maintained
information into the page, where userspace (libc) code can access that
information, without paying the cost of crossing protection domains
(syscall overhead or other means to trap into the kernel).
For gettimeofday(), put base time-of-day, cycle-count, and a
context-switch counter in the page, and you can compute gettimeofday()
in userspace. (use the csw counter to restart if a context-switch
happens in the userspace code; c.f. LBL (Van Jacobsen? Craig Leres?)
gettimeofday() for sun4c. Add frills as necessary for SMP).