18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_LINKAGE_H
38c2ecf20Sopenharmony_ci#define __ASM_LINKAGE_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define __ALIGN .align 4
68c2ecf20Sopenharmony_ci#define __ALIGN_STR ".align 4"
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci * Make sure the compiler doesn't do anything stupid with the
108c2ecf20Sopenharmony_ci * arguments on the stack - they are owned by the *caller*, not
118c2ecf20Sopenharmony_ci * the callee. This just fools gcc into not spilling into them,
128c2ecf20Sopenharmony_ci * and keeps it from doing tailcall recursion and/or using the
138c2ecf20Sopenharmony_ci * stack slots for temporaries, since they are live and "used"
148c2ecf20Sopenharmony_ci * all the way to the end of the function.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci#define asmlinkage_protect(n, ret, args...) \
178c2ecf20Sopenharmony_ci	__asmlinkage_protect##n(ret, ##args)
188c2ecf20Sopenharmony_ci#define __asmlinkage_protect_n(ret, args...) \
198c2ecf20Sopenharmony_ci	__asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
208c2ecf20Sopenharmony_ci#define __asmlinkage_protect0(ret) \
218c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret)
228c2ecf20Sopenharmony_ci#define __asmlinkage_protect1(ret, arg1) \
238c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret, "m" (arg1))
248c2ecf20Sopenharmony_ci#define __asmlinkage_protect2(ret, arg1, arg2) \
258c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2))
268c2ecf20Sopenharmony_ci#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
278c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3))
288c2ecf20Sopenharmony_ci#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
298c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
308c2ecf20Sopenharmony_ci			      "m" (arg4))
318c2ecf20Sopenharmony_ci#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
328c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
338c2ecf20Sopenharmony_ci			      "m" (arg4), "m" (arg5))
348c2ecf20Sopenharmony_ci#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
358c2ecf20Sopenharmony_ci	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
368c2ecf20Sopenharmony_ci			      "m" (arg4), "m" (arg5), "m" (arg6))
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#endif
39