linkage.h (1583B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __ASM_LINKAGE_H 3#define __ASM_LINKAGE_H 4 5#define __ALIGN .align 4 6#define __ALIGN_STR ".align 4" 7 8/* 9 * Make sure the compiler doesn't do anything stupid with the 10 * arguments on the stack - they are owned by the *caller*, not 11 * the callee. This just fools gcc into not spilling into them, 12 * and keeps it from doing tailcall recursion and/or using the 13 * stack slots for temporaries, since they are live and "used" 14 * all the way to the end of the function. 15 */ 16#define asmlinkage_protect(n, ret, args...) \ 17 __asmlinkage_protect##n(ret, ##args) 18#define __asmlinkage_protect_n(ret, args...) \ 19 __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args) 20#define __asmlinkage_protect0(ret) \ 21 __asmlinkage_protect_n(ret) 22#define __asmlinkage_protect1(ret, arg1) \ 23 __asmlinkage_protect_n(ret, "m" (arg1)) 24#define __asmlinkage_protect2(ret, arg1, arg2) \ 25 __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2)) 26#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \ 27 __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3)) 28#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \ 29 __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ 30 "m" (arg4)) 31#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \ 32 __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ 33 "m" (arg4), "m" (arg5)) 34#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \ 35 __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ 36 "m" (arg4), "m" (arg5), "m" (arg6)) 37 38#endif