linkage.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
  14. #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE)
  15. /*
  16. * For assembly routines.
  17. *
  18. * Note when using these that you must specify the appropriate
  19. * alignment directives yourself
  20. */
  21. #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw"
  22. #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw"
  23. /*
  24. * This is used by architectures to keep arguments on the stack
  25. * untouched by the compiler by keeping them live until the end.
  26. * The argument stack may be owned by the assembly-language
  27. * caller, not the callee, and gcc doesn't always understand
  28. * that.
  29. *
  30. * We have the return value, and a maximum of six arguments.
  31. *
  32. * This should always be followed by a "return ret" for the
  33. * protection to work (ie no more work that the compiler might
  34. * end up needing stack temporaries for).
  35. */
  36. /* Assembly files may be compiled with -traditional .. */
  37. #ifndef __ASSEMBLY__
  38. #ifndef asmlinkage_protect
  39. # define asmlinkage_protect(n, ret, args...) do { } while (0)
  40. #endif
  41. #endif
  42. #ifndef __ALIGN
  43. #define __ALIGN .align 4,0x90
  44. #define __ALIGN_STR ".align 4,0x90"
  45. #endif
  46. #ifdef __ASSEMBLY__
  47. #ifndef LINKER_SCRIPT
  48. #define ALIGN __ALIGN
  49. #define ALIGN_STR __ALIGN_STR
  50. #ifndef ENTRY
  51. #define ENTRY(name) \
  52. .globl name; \
  53. ALIGN; \
  54. name:
  55. #endif
  56. #endif /* LINKER_SCRIPT */
  57. #ifndef WEAK
  58. #define WEAK(name) \
  59. .weak name; \
  60. name:
  61. #endif
  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. #endif