Blame view

include/linux/linkage.h 2.6 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_LINKAGE_H
  #define _LINUX_LINKAGE_H
a7bf0bd5e   Jeremy Fitzhardinge   build: add __page...
3
  #include <linux/compiler.h>
e1b5bb6d1   Al Viro   consolidate cond_...
4
  #include <linux/stringify.h>
f8ce1faf5   Linus Torvalds   Merge tag 'module...
5
  #include <linux/export.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
  #include <asm/linkage.h>
9df62f054   Chen Gang   arch: use ASM_NL ...
7
8
9
10
  /* Some toolchains use other characters (e.g. '`') to mark new line in macro */
  #ifndef ASM_NL
  #define ASM_NL		 ;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
  #ifdef __cplusplus
3adc1beac   Andi Kleen   asmlinkage: Rever...
12
  #define CPP_ASMLINKAGE extern "C"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
  #else
3adc1beac   Andi Kleen   asmlinkage: Rever...
14
  #define CPP_ASMLINKAGE
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
17
18
19
  #endif
  
  #ifndef asmlinkage
  #define asmlinkage CPP_ASMLINKAGE
  #endif
e1b5bb6d1   Al Viro   consolidate cond_...
20
  #ifndef cond_syscall
f8ce1faf5   Linus Torvalds   Merge tag 'module...
21
22
23
24
25
  #define cond_syscall(x)	asm(				\
  	".weak " VMLINUX_SYMBOL_STR(x) "
  \t"		\
  	".set  " VMLINUX_SYMBOL_STR(x) ","		\
  		 VMLINUX_SYMBOL_STR(sys_ni_syscall))
e1b5bb6d1   Al Viro   consolidate cond_...
26
27
28
  #endif
  
  #ifndef SYSCALL_ALIAS
f8ce1faf5   Linus Torvalds   Merge tag 'module...
29
30
31
32
33
  #define SYSCALL_ALIAS(alias, name) asm(			\
  	".globl " VMLINUX_SYMBOL_STR(alias) "
  \t"	\
  	".set   " VMLINUX_SYMBOL_STR(alias) ","		\
  		  VMLINUX_SYMBOL_STR(name))
e1b5bb6d1   Al Viro   consolidate cond_...
34
  #endif
75b134837   Tim Abbott   Rename .data.page...
35
  #define __page_aligned_data	__section(.data..page_aligned) __aligned(PAGE_SIZE)
7c74df07f   Tim Abbott   Rename .bss.page_...
36
  #define __page_aligned_bss	__section(.bss..page_aligned) __aligned(PAGE_SIZE)
a7bf0bd5e   Jeremy Fitzhardinge   build: add __page...
37

d10d89ec7   Linus Torvalds   Add commentary ab...
38
  /*
d2af12aea   Tim Abbott   Add new macros fo...
39
40
41
42
43
   * For assembly routines.
   *
   * Note when using these that you must specify the appropriate
   * alignment directives yourself
   */
75b134837   Tim Abbott   Rename .data.page...
44
  #define __PAGE_ALIGNED_DATA	.section ".data..page_aligned", "aw"
7c74df07f   Tim Abbott   Rename .bss.page_...
45
  #define __PAGE_ALIGNED_BSS	.section ".bss..page_aligned", "aw"
d2af12aea   Tim Abbott   Add new macros fo...
46
47
  
  /*
d10d89ec7   Linus Torvalds   Add commentary ab...
48
49
50
51
52
53
54
55
56
57
58
59
   * This is used by architectures to keep arguments on the stack
   * untouched by the compiler by keeping them live until the end.
   * The argument stack may be owned by the assembly-language
   * caller, not the callee, and gcc doesn't always understand
   * that.
   *
   * We have the return value, and a maximum of six arguments.
   *
   * This should always be followed by a "return ret" for the
   * protection to work (ie no more work that the compiler might
   * end up needing stack temporaries for).
   */
b0fac0237   Heiko Carstens   Fix "$(AS) -tradi...
60
61
  /* Assembly files may be compiled with -traditional .. */
  #ifndef __ASSEMBLY__
54a015104   Roland McGrath   asmlinkage_protec...
62
63
  #ifndef asmlinkage_protect
  # define asmlinkage_protect(n, ret, args...)	do { } while (0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
  #endif
b0fac0237   Heiko Carstens   Fix "$(AS) -tradi...
65
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
67
68
69
70
71
72
  
  #ifndef __ALIGN
  #define __ALIGN		.align 4,0x90
  #define __ALIGN_STR	".align 4,0x90"
  #endif
  
  #ifdef __ASSEMBLY__
42f29a252   Tim Abbott   kbuild: Don't def...
73
  #ifndef LINKER_SCRIPT
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
  #define ALIGN __ALIGN
  #define ALIGN_STR __ALIGN_STR
ab7efcc97   Jan Beulich   [PATCH] abstract ...
76
  #ifndef ENTRY
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
  #define ENTRY(name) \
9df62f054   Chen Gang   arch: use ASM_NL ...
78
79
80
  	.globl name ASM_NL \
  	ALIGN ASM_NL \
  	name:
ab7efcc97   Jan Beulich   [PATCH] abstract ...
81
  #endif
42f29a252   Tim Abbott   kbuild: Don't def...
82
  #endif /* LINKER_SCRIPT */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
83

214541d1f   Rusty Russell   add WEAK() for cr...
84
85
  #ifndef WEAK
  #define WEAK(name)	   \
9df62f054   Chen Gang   arch: use ASM_NL ...
86
  	.weak name ASM_NL   \
214541d1f   Rusty Russell   add WEAK() for cr...
87
88
  	name:
  #endif
ab7efcc97   Jan Beulich   [PATCH] abstract ...
89
90
  #ifndef END
  #define END(name) \
9df62f054   Chen Gang   arch: use ASM_NL ...
91
  	.size name, .-name
ab7efcc97   Jan Beulich   [PATCH] abstract ...
92
  #endif
6b8be6df7   John Reiser   x86: add ENDPROC(...
93
94
95
96
  /* If symbol 'name' is treated as a subroutine (gets called, and returns)
   * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
   * static analysis tools such as stack depth analyzer.
   */
ab7efcc97   Jan Beulich   [PATCH] abstract ...
97
98
  #ifndef ENDPROC
  #define ENDPROC(name) \
9df62f054   Chen Gang   arch: use ASM_NL ...
99
100
  	.type name, @function ASM_NL \
  	END(name)
ab7efcc97   Jan Beulich   [PATCH] abstract ...
101
  #endif
d0aaff979   Prasanna S Panchamukhi   [PATCH] Kprobes: ...
102

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
103
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
  #endif