Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251984
b: refs/heads/master
c: f144a6b
h: refs/heads/master
v: v3
  • Loading branch information
Andy Lutomirski authored and Thomas Gleixner committed May 24, 2011
1 parent 8c3760c commit ea0a281
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6447facba36e3fff77ab4c68f46297a5dab024c8
refs/heads/master: f144a6b4d1688675d88990e29567b2335b48205e
35 changes: 34 additions & 1 deletion trunk/arch/x86/vdso/vclock_gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2006 Andi Kleen, SUSE Labs.
* Subject to the GNU Public License, v.2
*
* Fast user context implementation of clock_gettime and gettimeofday.
* Fast user context implementation of clock_gettime, gettimeofday, and time.
*
* The code should have no internal unresolved relocations.
* Check with readelf after changing.
Expand Down Expand Up @@ -160,3 +160,36 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
}
int gettimeofday(struct timeval *, struct timezone *)
__attribute__((weak, alias("__vdso_gettimeofday")));

/* This will break when the xtime seconds get inaccurate, but that is
* unlikely */

static __always_inline long time_syscall(long *t)
{
long secs;
asm volatile("syscall"
: "=a" (secs)
: "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
return secs;
}

notrace time_t __vdso_time(time_t *t)
{
unsigned seq;
time_t result;
if (unlikely(!VVAR(vsyscall_gtod_data).sysctl_enabled))
return time_syscall(t);

do {
seq = read_seqbegin(&VVAR(vsyscall_gtod_data).lock);

result = VVAR(vsyscall_gtod_data).wall_time_sec;

} while (read_seqretry(&VVAR(vsyscall_gtod_data).lock, seq));

if (t)
*t = result;
return result;
}
int time(time_t *t)
__attribute__((weak, alias("__vdso_time")));
2 changes: 2 additions & 0 deletions trunk/arch/x86/vdso/vdso.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ VERSION {
__vdso_gettimeofday;
getcpu;
__vdso_getcpu;
time;
__vdso_time;
local: *;
};
}
Expand Down

0 comments on commit ea0a281

Please sign in to comment.