162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * syscall_wrapper.h - powerpc specific wrappers to syscall definitions 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Based on arch/{x86,arm64}/include/asm/syscall_wrapper.h 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef __ASM_POWERPC_SYSCALL_WRAPPER_H 962306a36Sopenharmony_ci#define __ASM_POWERPC_SYSCALL_WRAPPER_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct pt_regs; 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define SC_POWERPC_REGS_TO_ARGS(x, ...) \ 1462306a36Sopenharmony_ci __MAP(x,__SC_ARGS \ 1562306a36Sopenharmony_ci ,,regs->gpr[3],,regs->gpr[4],,regs->gpr[5] \ 1662306a36Sopenharmony_ci ,,regs->gpr[6],,regs->gpr[7],,regs->gpr[8]) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define __SYSCALL_DEFINEx(x, name, ...) \ 1962306a36Sopenharmony_ci long sys##name(const struct pt_regs *regs); \ 2062306a36Sopenharmony_ci ALLOW_ERROR_INJECTION(sys##name, ERRNO); \ 2162306a36Sopenharmony_ci static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ 2262306a36Sopenharmony_ci static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 2362306a36Sopenharmony_ci long sys##name(const struct pt_regs *regs) \ 2462306a36Sopenharmony_ci { \ 2562306a36Sopenharmony_ci return __se_sys##name(SC_POWERPC_REGS_TO_ARGS(x,__VA_ARGS__)); \ 2662306a36Sopenharmony_ci } \ 2762306a36Sopenharmony_ci static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 2862306a36Sopenharmony_ci { \ 2962306a36Sopenharmony_ci long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ 3062306a36Sopenharmony_ci __MAP(x,__SC_TEST,__VA_ARGS__); \ 3162306a36Sopenharmony_ci __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ 3262306a36Sopenharmony_ci return ret; \ 3362306a36Sopenharmony_ci } \ 3462306a36Sopenharmony_ci static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define SYSCALL_DEFINE0(sname) \ 3762306a36Sopenharmony_ci SYSCALL_METADATA(_##sname, 0); \ 3862306a36Sopenharmony_ci long sys_##sname(const struct pt_regs *__unused); \ 3962306a36Sopenharmony_ci ALLOW_ERROR_INJECTION(sys_##sname, ERRNO); \ 4062306a36Sopenharmony_ci long sys_##sname(const struct pt_regs *__unused) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define COND_SYSCALL(name) \ 4362306a36Sopenharmony_ci long sys_##name(const struct pt_regs *regs); \ 4462306a36Sopenharmony_ci long __weak sys_##name(const struct pt_regs *regs) \ 4562306a36Sopenharmony_ci { \ 4662306a36Sopenharmony_ci return sys_ni_syscall(); \ 4762306a36Sopenharmony_ci } 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#endif // __ASM_POWERPC_SYSCALL_WRAPPER_H 50