vsyscall.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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