linkage.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #ifndef LINKER_SCRIPT
  51. #define ALIGN __ALIGN
  52. #define ALIGN_STR __ALIGN_STR
  53. #ifndef ENTRY
  54. #define ENTRY(name) \
  55. .globl name; \
  56. ALIGN; \
  57. name:
  58. #endif
  59. #endif /* LINKER_SCRIPT */
  60. #ifndef WEAK
  61. #define WEAK(name) \
  62. .weak name; \
  63. name:
  64. #endif
  65. #ifndef END
  66. #define END(name) \
  67. .size name, .-name
  68. #endif
  69. /* If symbol 'name' is treated as a subroutine (gets called, and returns)
  70. * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
  71. * static analysis tools such as stack depth analyzer.
  72. */
  73. #ifndef ENDPROC
  74. #define ENDPROC(name) \
  75. .type name, @function; \
  76. END(name)
  77. #endif
  78. #endif
  79. #define NORET_TYPE /**/
  80. #define ATTRIB_NORET __attribute__((noreturn))
  81. #define NORET_AND noreturn,
  82. #endif