linkage.h 2.1 KB

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