12 #define DISABLE_BRANCH_PROFILING
14 #include <linux/kernel.h>
16 #include <linux/time.h>
17 #include <linux/string.h>
19 #include <asm/fixmap.h>
21 #include <asm/timex.h>
23 #include <asm/unistd.h>
26 #define gtod (&VVAR(vsyscall_gtod_data))
68 asm(
"syscall" :
"=a" (
ret) :
77 asm(
"syscall" :
"=a" (
ret) :
87 if (
gtod->clock.vclock_mode == VCLOCK_TSC)
89 else if (
gtod->clock.vclock_mode == VCLOCK_HPET)
90 cycles = vread_hpet();
93 v = (cycles -
gtod->clock.cycle_last) &
gtod->clock.mask;
94 return v *
gtod->clock.mult;
106 seq = read_seqcount_begin(&
gtod->seq);
107 mode =
gtod->clock.vclock_mode;
109 ns =
gtod->wall_time_snsec;
111 ns >>=
gtod->clock.shift;
112 }
while (
unlikely(read_seqcount_retry(&
gtod->seq, seq)));
114 timespec_add_ns(ts, ns);
126 seq = read_seqcount_begin(&
gtod->seq);
127 mode =
gtod->clock.vclock_mode;
129 ns =
gtod->monotonic_time_snsec;
131 ns >>=
gtod->clock.shift;
132 }
while (
unlikely(read_seqcount_retry(&
gtod->seq, seq)));
133 timespec_add_ns(ts, ns);
142 seq = read_seqcount_begin(&
gtod->seq);
145 }
while (
unlikely(read_seqcount_retry(&
gtod->seq, seq)));
153 seq = read_seqcount_begin(&
gtod->seq);
154 ts->
tv_sec =
gtod->monotonic_time_coarse.tv_sec;
156 }
while (
unlikely(read_seqcount_retry(&
gtod->seq, seq)));
163 int ret = VCLOCK_NONE;
167 ret = do_realtime(ts);
170 ret = do_monotonic(ts);
173 return do_realtime_coarse(ts);
175 return do_monotonic_coarse(ts);
178 if (ret == VCLOCK_NONE)
179 return vdso_fallback_gettime(clock, ts);
187 long ret = VCLOCK_NONE;
192 sizeof(*tv) !=
sizeof(
struct timespec));
193 ret = do_realtime((
struct timespec *)tv);
198 tz->tz_minuteswest =
gtod->sys_tz.tz_minuteswest;
199 tz->tz_dsttime =
gtod->sys_tz.tz_dsttime;
202 if (ret == VCLOCK_NONE)
203 return vdso_fallback_gtod(tv, tz);