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