system_32.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef __ASM_SYSTEM_H
  2. #define __ASM_SYSTEM_H
  3. #include <asm/segment.h>
  4. #include <asm/cpufeature.h>
  5. #include <asm/cmpxchg.h>
  6. #ifdef __KERNEL__
  7. #define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
  8. struct task_struct; /* one of the stranger aspects of C forward declarations.. */
  9. extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
  10. /*
  11. * Saving eflags is important. It switches not only IOPL between tasks,
  12. * it also protects other tasks from NT leaking through sysenter etc.
  13. */
  14. #define switch_to(prev,next,last) do { \
  15. unsigned long esi,edi; \
  16. asm volatile("pushfl\n\t" /* Save flags */ \
  17. "pushl %%ebp\n\t" \
  18. "movl %%esp,%0\n\t" /* save ESP */ \
  19. "movl %5,%%esp\n\t" /* restore ESP */ \
  20. "movl $1f,%1\n\t" /* save EIP */ \
  21. "pushl %6\n\t" /* restore EIP */ \
  22. "jmp __switch_to\n" \
  23. "1:\t" \
  24. "popl %%ebp\n\t" \
  25. "popfl" \
  26. :"=m" (prev->thread.sp),"=m" (prev->thread.ip), \
  27. "=a" (last),"=S" (esi),"=D" (edi) \
  28. :"m" (next->thread.sp),"m" (next->thread.ip), \
  29. "2" (prev), "d" (next)); \
  30. } while (0)
  31. #endif /* __KERNEL__ */
  32. #include <linux/irqflags.h>
  33. /*
  34. * disable hlt during certain critical i/o operations
  35. */
  36. #define HAVE_DISABLE_HLT
  37. #endif