linkage.h 1.8 KB

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