linkage.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _ASM_X86_LINKAGE_H
  2. #define _ASM_X86_LINKAGE_H
  3. #include <linux/stringify.h>
  4. #undef notrace
  5. #define notrace __attribute__((no_instrument_function))
  6. #ifdef CONFIG_X86_32
  7. #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
  8. /*
  9. * Make sure the compiler doesn't do anything stupid with the
  10. * arguments on the stack - they are owned by the *caller*, not
  11. * the callee. This just fools gcc into not spilling into them,
  12. * and keeps it from doing tailcall recursion and/or using the
  13. * stack slots for temporaries, since they are live and "used"
  14. * all the way to the end of the function.
  15. *
  16. * NOTE! On x86-64, all the arguments are in registers, so this
  17. * only matters on a 32-bit kernel.
  18. */
  19. #define asmlinkage_protect(n, ret, args...) \
  20. __asmlinkage_protect##n(ret, ##args)
  21. #define __asmlinkage_protect_n(ret, args...) \
  22. __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
  23. #define __asmlinkage_protect0(ret) \
  24. __asmlinkage_protect_n(ret)
  25. #define __asmlinkage_protect1(ret, arg1) \
  26. __asmlinkage_protect_n(ret, "g" (arg1))
  27. #define __asmlinkage_protect2(ret, arg1, arg2) \
  28. __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2))
  29. #define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
  30. __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3))
  31. #define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
  32. __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
  33. "g" (arg4))
  34. #define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
  35. __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
  36. "g" (arg4), "g" (arg5))
  37. #define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
  38. __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
  39. "g" (arg4), "g" (arg5), "g" (arg6))
  40. #endif /* CONFIG_X86_32 */
  41. #ifdef __ASSEMBLY__
  42. #define GLOBAL(name) \
  43. .globl name; \
  44. name:
  45. #if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
  46. #define __ALIGN .p2align 4, 0x90
  47. #define __ALIGN_STR __stringify(__ALIGN)
  48. #endif
  49. #endif /* __ASSEMBLY__ */
  50. #endif /* _ASM_X86_LINKAGE_H */