arch/x86/include/asm/vdso/gettimeofday.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/vdso/gettimeofday.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/vdso/gettimeofday.h- Extension
.h- Size
- 7423 bytes
- Lines
- 245
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
uapi/linux/time.hasm/vgtod.hasm/unistd.hasm/msr.hasm/pvclock.hclocksource/hyperv_timer.hasm/vdso/sys_call.h
Detected Declarations
function clock_gettime_fallbackfunction gettimeofday_fallbackfunction clock_getres_fallbackfunction clock_gettime32_fallbackfunction clock_getres32_fallbackfunction vread_pvclockfunction vread_hvclockfunction __arch_get_hw_counterfunction arch_vdso_clocksource_okfunction arch_vdso_cycles_okfunction calculationfunction arch_vdso_cycles_ok
Annotated Snippet
#ifndef __ASM_VDSO_GETTIMEOFDAY_H
#define __ASM_VDSO_GETTIMEOFDAY_H
#ifndef __ASSEMBLER__
#include <uapi/linux/time.h>
#include <asm/vgtod.h>
#include <asm/unistd.h>
#include <asm/msr.h>
#include <asm/pvclock.h>
#include <clocksource/hyperv_timer.h>
#include <asm/vdso/sys_call.h>
#define VDSO_HAS_TIME 1
#define VDSO_HAS_CLOCK_GETRES 1
/*
* Declare the memory-mapped vclock data pages. These come from hypervisors.
* If we ever reintroduce something like direct access to an MMIO clock like
* the HPET again, it will go here as well.
*
* A load from any of these pages will segfault if the clock in question is
* disabled, so appropriate compiler barriers and checks need to be used
* to prevent stray loads.
*
* These declarations MUST NOT be const. The compiler will assume that
* an extern const variable has genuinely constant contents, and the
* resulting code won't work, since the whole point is that these pages
* change over time, possibly while we're accessing them.
*/
#ifdef CONFIG_PARAVIRT_CLOCK
/*
* This is the vCPU 0 pvclock page. We only use pvclock from the vDSO
* if the hypervisor tells us that all vCPUs can get valid data from the
* vCPU 0 page.
*/
extern struct pvclock_vsyscall_time_info pvclock_page
__attribute__((visibility("hidden")));
#endif
#ifdef CONFIG_HYPERV_TIMER
extern struct ms_hyperv_tsc_page hvclock_page
__attribute__((visibility("hidden")));
#endif
static __always_inline
long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
return VDSO_SYSCALL2(clock_gettime,64,_clkid,_ts);
}
static __always_inline
long gettimeofday_fallback(struct __kernel_old_timeval *_tv,
struct timezone *_tz)
{
return VDSO_SYSCALL2(gettimeofday,,_tv,_tz);
}
static __always_inline
long clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
return VDSO_SYSCALL2(clock_getres,_time64,_clkid,_ts);
}
#ifndef CONFIG_X86_64
static __always_inline
long clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
{
return VDSO_SYSCALL2(clock_gettime,,_clkid,_ts);
}
static __always_inline long
clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
{
return VDSO_SYSCALL2(clock_getres,,_clkid,_ts);
}
#endif
#ifdef CONFIG_PARAVIRT_CLOCK
static u64 vread_pvclock(void)
{
const struct pvclock_vcpu_time_info *pvti = &pvclock_page.pvti;
u32 version;
u64 ret;
/*
Annotation
- Immediate include surface: `uapi/linux/time.h`, `asm/vgtod.h`, `asm/unistd.h`, `asm/msr.h`, `asm/pvclock.h`, `clocksource/hyperv_timer.h`, `asm/vdso/sys_call.h`.
- Detected declarations: `function clock_gettime_fallback`, `function gettimeofday_fallback`, `function clock_getres_fallback`, `function clock_gettime32_fallback`, `function clock_getres32_fallback`, `function vread_pvclock`, `function vread_hvclock`, `function __arch_get_hw_counter`, `function arch_vdso_clocksource_ok`, `function arch_vdso_cycles_ok`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.