aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/linkage.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/linkage.h')
-rw-r--r--include/asm-x86/linkage.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/include/asm-x86/linkage.h b/include/asm-x86/linkage.h
index 31739c7d66a9..c048353f4b85 100644
--- a/include/asm-x86/linkage.h
+++ b/include/asm-x86/linkage.h
@@ -8,12 +8,45 @@
8 8
9#ifdef CONFIG_X86_32 9#ifdef CONFIG_X86_32
10#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) 10#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
11#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret))
12/* 11/*
13 * For 32-bit UML - mark functions implemented in assembly that use 12 * For 32-bit UML - mark functions implemented in assembly that use
14 * regparm input parameters: 13 * regparm input parameters:
15 */ 14 */
16#define asmregparm __attribute__((regparm(3))) 15#define asmregparm __attribute__((regparm(3)))
16
17/*
18 * Make sure the compiler doesn't do anything stupid with the
19 * arguments on the stack - they are owned by the *caller*, not
20 * the callee. This just fools gcc into not spilling into them,
21 * and keeps it from doing tailcall recursion and/or using the
22 * stack slots for temporaries, since they are live and "used"
23 * all the way to the end of the function.
24 *
25 * NOTE! On x86-64, all the arguments are in registers, so this
26 * only matters on a 32-bit kernel.
27 */
28#define asmlinkage_protect(n, ret, args...) \
29 __asmlinkage_protect##n(ret, ##args)
30#define __asmlinkage_protect_n(ret, args...) \
31 __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
32#define __asmlinkage_protect0(ret) \
33 __asmlinkage_protect_n(ret)
34#define __asmlinkage_protect1(ret, arg1) \
35 __asmlinkage_protect_n(ret, "g" (arg1))
36#define __asmlinkage_protect2(ret, arg1, arg2) \
37 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2))
38#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
39 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3))
40#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
41 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
42 "g" (arg4))
43#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
44 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
45 "g" (arg4), "g" (arg5))
46#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
47 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
48 "g" (arg4), "g" (arg5), "g" (arg6))
49
17#endif 50#endif
18 51
19#ifdef CONFIG_X86_ALIGNMENT_16 52#ifdef CONFIG_X86_ALIGNMENT_16