linkage.h 2.1 KB

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