vsyscall.h 873 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _ASM_X86_VSYSCALL_H
  2. #define _ASM_X86_VSYSCALL_H
  3. #include <linux/seqlock.h>
  4. #include <uapi/asm/vsyscall.h>
  5. #define VGETCPU_RDTSCP 1
  6. #define VGETCPU_LSL 2
  7. /* kernel space (writeable) */
  8. extern int vgetcpu_mode;
  9. extern struct timezone sys_tz;
  10. #include <asm/vvar.h>
  11. extern void map_vsyscall(void);
  12. /*
  13. * Called on instruction fetch fault in vsyscall page.
  14. * Returns true if handled.
  15. */
  16. extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
  17. #ifdef CONFIG_X86_64
  18. #define VGETCPU_CPU_MASK 0xfff
  19. static inline unsigned int __getcpu(void)
  20. {
  21. unsigned int p;
  22. if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) {
  23. /* Load per CPU data from RDTSCP */
  24. native_read_tscp(&p);
  25. } else {
  26. /* Load per CPU data from GDT */
  27. asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
  28. }
  29. return p;
  30. }
  31. #endif /* CONFIG_X86_64 */
  32. #endif /* _ASM_X86_VSYSCALL_H */