SGI IA64 UV: fix ia64 build error in the linux-next tree
[deliverable/linux.git] / arch / x86 / include / asm / linkage.h
1 #ifndef _ASM_X86_LINKAGE_H
2 #define _ASM_X86_LINKAGE_H
3
4 #undef notrace
5 #define notrace __attribute__((no_instrument_function))
6
7 #ifdef CONFIG_X86_64
8 #define __ALIGN .p2align 4,,15
9 #define __ALIGN_STR ".p2align 4,,15"
10 #endif
11
12 #ifdef CONFIG_X86_32
13 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
14 /*
15 * For 32-bit UML - mark functions implemented in assembly that use
16 * regparm input parameters:
17 */
18 #define asmregparm __attribute__((regparm(3)))
19
20 /*
21 * For syscalls that need a pointer to the pt_regs struct (ie. fork).
22 * The regs pointer is passed in %eax as the first argument. The
23 * remaining function arguments remain on the stack.
24 */
25 #define ptregscall __attribute__((regparm(1)))
26
27 /*
28 * Make sure the compiler doesn't do anything stupid with the
29 * arguments on the stack - they are owned by the *caller*, not
30 * the callee. This just fools gcc into not spilling into them,
31 * and keeps it from doing tailcall recursion and/or using the
32 * stack slots for temporaries, since they are live and "used"
33 * all the way to the end of the function.
34 *
35 * NOTE! On x86-64, all the arguments are in registers, so this
36 * only matters on a 32-bit kernel.
37 */
38 #define asmlinkage_protect(n, ret, args...) \
39 __asmlinkage_protect##n(ret, ##args)
40 #define __asmlinkage_protect_n(ret, args...) \
41 __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
42 #define __asmlinkage_protect0(ret) \
43 __asmlinkage_protect_n(ret)
44 #define __asmlinkage_protect1(ret, arg1) \
45 __asmlinkage_protect_n(ret, "g" (arg1))
46 #define __asmlinkage_protect2(ret, arg1, arg2) \
47 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2))
48 #define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
49 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3))
50 #define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
51 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
52 "g" (arg4))
53 #define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
54 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
55 "g" (arg4), "g" (arg5))
56 #define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
57 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
58 "g" (arg4), "g" (arg5), "g" (arg6))
59
60 #endif
61
62 #ifdef CONFIG_X86_ALIGNMENT_16
63 #define __ALIGN .align 16,0x90
64 #define __ALIGN_STR ".align 16,0x90"
65 #endif
66
67 /*
68 * to check ENTRY_X86/END_X86 and
69 * KPROBE_ENTRY_X86/KPROBE_END_X86
70 * unbalanced-missed-mixed appearance
71 */
72 #define __set_entry_x86 .set ENTRY_X86_IN, 0
73 #define __unset_entry_x86 .set ENTRY_X86_IN, 1
74 #define __set_kprobe_x86 .set KPROBE_X86_IN, 0
75 #define __unset_kprobe_x86 .set KPROBE_X86_IN, 1
76
77 #define __macro_err_x86 .error "ENTRY_X86/KPROBE_X86 unbalanced,missed,mixed"
78
79 #define __check_entry_x86 \
80 .ifdef ENTRY_X86_IN; \
81 .ifeq ENTRY_X86_IN; \
82 __macro_err_x86; \
83 .abort; \
84 .endif; \
85 .endif
86
87 #define __check_kprobe_x86 \
88 .ifdef KPROBE_X86_IN; \
89 .ifeq KPROBE_X86_IN; \
90 __macro_err_x86; \
91 .abort; \
92 .endif; \
93 .endif
94
95 #define __check_entry_kprobe_x86 \
96 __check_entry_x86; \
97 __check_kprobe_x86
98
99 #define ENTRY_KPROBE_FINAL_X86 __check_entry_kprobe_x86
100
101 #define ENTRY_X86(name) \
102 __check_entry_kprobe_x86; \
103 __set_entry_x86; \
104 .globl name; \
105 __ALIGN; \
106 name:
107
108 #define END_X86(name) \
109 __unset_entry_x86; \
110 __check_entry_kprobe_x86; \
111 .size name, .-name
112
113 #define KPROBE_ENTRY_X86(name) \
114 __check_entry_kprobe_x86; \
115 __set_kprobe_x86; \
116 .pushsection .kprobes.text, "ax"; \
117 .globl name; \
118 __ALIGN; \
119 name:
120
121 #define KPROBE_END_X86(name) \
122 __unset_kprobe_x86; \
123 __check_entry_kprobe_x86; \
124 .size name, .-name; \
125 .popsection
126
127 #endif /* _ASM_X86_LINKAGE_H */
128
This page took 0.036483 seconds and 5 git commands to generate.