linkage.h 2.1 KB

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