lkml.org 
[lkml]   [2011]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 3/3] um: Implement a x86_64 vDSO
    On Wed, Jul 20, 2011 at 2:09 PM, Richard Weinberger <richard@nod.at> wrote:
    > Am Mittwoch 20 Juli 2011, 19:54:02 schrieb Andy Lutomirski:
    >> On 07/18/2011 09:07 AM, Richard Weinberger wrote:
    >> > Until now UML had no x86_64 vDSO.
    >> > So glibc always used the vsyscall page for gettimeday()
    >> > and friends.
    >> > Calls to gettimeday() returned falsely the host time and
    >> > confused some programs.
    >> >
    >> > This patch adds a vDSO which turns all __vdso_* calls into
    >> > a system call so that UML can trap them.
    >> >
    >> > As glibc still uses the vsyscall page for static binaries this
    >> > patch improves the situation only for dynamic binaries.
    >> >
    >> > Signed-off-by: Richard Weinberger<richard@nod.at>
    >> >
    >> > +   asm("syscall" : "=a" (ret) :
    >> > +           "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
    >> > +
    >>
    >> The x86-64 ABI and glibc think that rcx, and r11 are clobbered.  glibc
    >> also thinks that cc is clobbered.  I personally think that rdx and
    >> r8-r15 ought to be clobbered under the principle that syscall should
    >> look like a function call.
    >
    > Hmm, I thought my implementation is fine because it follows
    > arch/x86/vdso/vclock_gettime.c (Linus' tree).
    >
    > notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
    > {
    >  long ret;
    >  asm("syscall" : "=a" (ret) :
    >      "0" (__NR_clock_gettime),"D" (clock), "S" (ts) : "memory");
    >  return ret;
    > }
    >
    > Am I missing something or needs vdso_fallback_gettime() also some updates?

    vdso_fallback_gettime is going away :)

    I haven't read all of the sysret code paths, but it looks like at
    least r11 is used in a comment. That being said, your code is an
    uninlinable function, and functions already clobber all those
    registers, so the code shouldn't cause problems in real life.

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

    \
     
     \ /
      Last update: 2011-07-20 20:21    [W:0.024 / U:0.432 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site