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