linkage.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef _LINUX_LINKAGE_H
  2. #define _LINUX_LINKAGE_H
  3. #include <asm/linkage.h>
  4. #define notrace __attribute__((no_instrument_function))
  5. #ifdef __cplusplus
  6. #define CPP_ASMLINKAGE extern "C"
  7. #else
  8. #define CPP_ASMLINKAGE
  9. #endif
  10. #ifndef asmlinkage
  11. #define asmlinkage CPP_ASMLINKAGE
  12. #endif
  13. #ifndef asmregparm
  14. # define asmregparm
  15. #endif
  16. /*
  17. * This is used by architectures to keep arguments on the stack
  18. * untouched by the compiler by keeping them live until the end.
  19. * The argument stack may be owned by the assembly-language
  20. * caller, not the callee, and gcc doesn't always understand
  21. * that.
  22. *
  23. * We have the return value, and a maximum of six arguments.
  24. *
  25. * This should always be followed by a "return ret" for the
  26. * protection to work (ie no more work that the compiler might
  27. * end up needing stack temporaries for).
  28. */
  29. /* Assembly files may be compiled with -traditional .. */
  30. #ifndef __ASSEMBLY__
  31. #ifndef asmlinkage_protect
  32. # define asmlinkage_protect(n, ret, args...) do { } while (0)
  33. #endif
  34. #endif
  35. #ifndef __ALIGN
  36. #define __ALIGN .align 4,0x90
  37. #define __ALIGN_STR ".align 4,0x90"
  38. #endif
  39. #ifdef __ASSEMBLY__
  40. #define ALIGN __ALIGN
  41. #define ALIGN_STR __ALIGN_STR
  42. #ifndef ENTRY
  43. #define ENTRY(name) \
  44. .globl name; \
  45. ALIGN; \
  46. name:
  47. #endif
  48. #ifndef WEAK
  49. #define WEAK(name) \
  50. .weak name; \
  51. name:
  52. #endif
  53. #define KPROBE_ENTRY(name) \
  54. .pushsection .kprobes.text, "ax"; \
  55. ENTRY(name)
  56. #define KPROBE_END(name) \
  57. END(name); \
  58. .popsection
  59. #ifndef END
  60. #define END(name) \
  61. .size name, .-name
  62. #endif
  63. /* If symbol 'name' is treated as a subroutine (gets called, and returns)
  64. * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
  65. * static analysis tools such as stack depth analyzer.
  66. */
  67. #ifndef ENDPROC
  68. #define ENDPROC(name) \
  69. .type name, @function; \
  70. END(name)
  71. #endif
  72. #endif
  73. #define NORET_TYPE /**/
  74. #define ATTRIB_NORET __attribute__((noreturn))
  75. #define NORET_AND noreturn,
  76. #endif