linkage.h 2.2 KB

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