Subject: Re: COMPAT_LINUX vsyscall
To: David Laight <david@l8s.co.uk>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: tech-kern
Date: 05/01/2005 16:28:19
In message <20050501221625.GQ5984@snowdrop.l8s.co.uk>,
David Laight writes:

>On Sun, May 01, 2005 at 02:50:06PM -0700, Jonathan Stone wrote:
>> >
>> >Why would you want to map a page of code into userspace?

[ gettimeofday() ]

>> 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).
>
>That is mapping data, not code.....


So the code which uses that data somewhere safe and nonmodifiable,
giving the same semantics as a full syscall?

I dont know amd-64 assembler, but the fragment Manu posted appears to
conditionally execute the heavyweight syscall.  The code at
fff... 0017, after the syscall, was not listed. I'd guess it does a
process-local gettimeofday() using kernel-maintained data mapped into
that, or an adjacent, page.