linkage.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #ifndef asmlinkage_protect
  29. # define asmlinkage_protect(n, ret, args...) do { } while (0)
  30. #endif
  31. #ifndef __ALIGN
  32. #define __ALIGN .align 4,0x90
  33. #define __ALIGN_STR ".align 4,0x90"
  34. #endif
  35. #ifdef __ASSEMBLY__
  36. #define ALIGN __ALIGN
  37. #define ALIGN_STR __ALIGN_STR
  38. #ifndef ENTRY
  39. #define ENTRY(name) \
  40. .globl name; \
  41. ALIGN; \
  42. name:
  43. #endif
  44. #ifndef WEAK
  45. #define WEAK(name) \
  46. .weak name; \
  47. name:
  48. #endif
  49. #define KPROBE_ENTRY(name) \
  50. .pushsection .kprobes.text, "ax"; \
  51. ENTRY(name)
  52. #define KPROBE_END(name) \
  53. END(name); \
  54. .popsection
  55. #ifndef END
  56. #define END(name) \
  57. .size name, .-name
  58. #endif
  59. /* If symbol 'name' is treated as a subroutine (gets called, and returns)
  60. * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
  61. * static analysis tools such as stack depth analyzer.
  62. */
  63. #ifndef ENDPROC
  64. #define ENDPROC(name) \
  65. .type name, @function; \
  66. END(name)
  67. #endif
  68. #endif
  69. #define NORET_TYPE /**/
  70. #define ATTRIB_NORET __attribute__((noreturn))
  71. #define NORET_AND noreturn,
  72. #endif