1#ifndef _ASM_X86_64_VSYSCALL_H_
2#define _ASM_X86_64_VSYSCALL_H_
3
4#include <linux/time.h>
5
6enum vsyscall_num {
7	__NR_vgettimeofday,
8	__NR_vtime,
9};
10
11#define VSYSCALL_START (-10UL << 20)
12#define VSYSCALL_SIZE 1024
13#define VSYSCALL_END (-2UL << 20)
14#define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
15
16#ifdef __KERNEL__
17
18#define __section_hpet __attribute__ ((unused, __section__ (".hpet"), aligned(16)))
19#define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16)))
20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
21#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
22#define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16)))
23#define __section_vxtime_sequence __attribute__ ((unused, __section__ (".vxtime_sequence"), aligned(16)))
24
25struct hpet_data {
26	long address;		/* base address */
27	unsigned long hz;	/* HPET clocks / sec */
28	int trigger;		/* value at last interrupt */
29	int last;
30	int offset;
31	unsigned long last_tsc;
32	long ticks;
33};
34
35#define hpet_readl(a)           readl(fix_to_virt(FIX_HPET_BASE) + a)
36#define hpet_writel(d,a)        writel(d, fix_to_virt(FIX_HPET_BASE) + a)
37
38/* vsyscall space (readonly) */
39extern long __vxtime_sequence[2];
40extern struct hpet_data __hpet;
41extern struct timeval __xtime;
42extern volatile unsigned long __jiffies;
43extern unsigned long __wall_jiffies;
44extern struct timezone __sys_tz;
45
46/* kernel space (writeable) */
47extern long vxtime_sequence[2];
48extern struct hpet_data hpet;
49extern unsigned long wall_jiffies;
50extern struct timezone sys_tz;
51
52#define vxtime_lock() do { vxtime_sequence[0]++; wmb(); } while(0)
53#define vxtime_unlock() do { wmb(); vxtime_sequence[1]++; } while (0)
54
55#endif /* __KERNEL__ */
56
57#endif /* _ASM_X86_64_VSYSCALL_H_ */
58