xref: /openbmc/linux/arch/m68k/include/asm/linkage.h (revision b2441318)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
249148020SSam Ravnborg #ifndef __ASM_LINKAGE_H
349148020SSam Ravnborg #define __ASM_LINKAGE_H
449148020SSam Ravnborg 
549148020SSam Ravnborg #define __ALIGN .align 4
649148020SSam Ravnborg #define __ALIGN_STR ".align 4"
749148020SSam Ravnborg 
88474ba74SAndreas Schwab /*
98474ba74SAndreas Schwab  * Make sure the compiler doesn't do anything stupid with the
108474ba74SAndreas Schwab  * arguments on the stack - they are owned by the *caller*, not
118474ba74SAndreas Schwab  * the callee. This just fools gcc into not spilling into them,
128474ba74SAndreas Schwab  * and keeps it from doing tailcall recursion and/or using the
138474ba74SAndreas Schwab  * stack slots for temporaries, since they are live and "used"
148474ba74SAndreas Schwab  * all the way to the end of the function.
158474ba74SAndreas Schwab  */
168474ba74SAndreas Schwab #define asmlinkage_protect(n, ret, args...) \
178474ba74SAndreas Schwab 	__asmlinkage_protect##n(ret, ##args)
188474ba74SAndreas Schwab #define __asmlinkage_protect_n(ret, args...) \
198474ba74SAndreas Schwab 	__asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
208474ba74SAndreas Schwab #define __asmlinkage_protect0(ret) \
218474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret)
228474ba74SAndreas Schwab #define __asmlinkage_protect1(ret, arg1) \
238474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret, "m" (arg1))
248474ba74SAndreas Schwab #define __asmlinkage_protect2(ret, arg1, arg2) \
258474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2))
268474ba74SAndreas Schwab #define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
278474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3))
288474ba74SAndreas Schwab #define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
298474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
308474ba74SAndreas Schwab 			      "m" (arg4))
318474ba74SAndreas Schwab #define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
328474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
338474ba74SAndreas Schwab 			      "m" (arg4), "m" (arg5))
348474ba74SAndreas Schwab #define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
358474ba74SAndreas Schwab 	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
368474ba74SAndreas Schwab 			      "m" (arg4), "m" (arg5), "m" (arg6))
378474ba74SAndreas Schwab 
3849148020SSam Ravnborg #endif
39