linkage.h 2.0 KB

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