treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / arm64 / include / asm / syscall_wrapper.h
blobb383b4802a7bdcf1b5851377529a03ef1b5bf536
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * syscall_wrapper.h - arm64 specific wrappers to syscall definitions
5 * Based on arch/x86/include/asm_syscall_wrapper.h
6 */
8 #ifndef __ASM_SYSCALL_WRAPPER_H
9 #define __ASM_SYSCALL_WRAPPER_H
11 struct pt_regs;
13 #define SC_ARM64_REGS_TO_ARGS(x, ...) \
14 __MAP(x,__SC_ARGS \
15 ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \
16 ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
18 #ifdef CONFIG_COMPAT
20 #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
21 asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs); \
22 ALLOW_ERROR_INJECTION(__arm64_compat_sys##name, ERRNO); \
23 static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
24 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
25 asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs) \
26 { \
27 return __se_compat_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__)); \
28 } \
29 static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
30 { \
31 return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
32 } \
33 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
35 #define COMPAT_SYSCALL_DEFINE0(sname) \
36 asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused); \
37 ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \
38 asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused)
40 #define COND_SYSCALL_COMPAT(name) \
41 asmlinkage long __weak __arm64_compat_sys_##name(const struct pt_regs *regs) \
42 { \
43 return sys_ni_syscall(); \
46 #define COMPAT_SYS_NI(name) \
47 SYSCALL_ALIAS(__arm64_compat_sys_##name, sys_ni_posix_timers);
49 #endif /* CONFIG_COMPAT */
51 #define __SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \
53 ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO); \
54 static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
55 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
56 asmlinkage long __arm64_sys##name(const struct pt_regs *regs) \
57 { \
58 return __se_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__)); \
59 } \
60 static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
61 { \
62 long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
63 __MAP(x,__SC_TEST,__VA_ARGS__); \
64 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
65 return ret; \
66 } \
67 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
69 #define SYSCALL_DEFINE0(sname) \
70 SYSCALL_METADATA(_##sname, 0); \
71 asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused); \
72 ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \
73 asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
75 #define COND_SYSCALL(name) \
76 asmlinkage long __weak __arm64_sys_##name(const struct pt_regs *regs) \
77 { \
78 return sys_ni_syscall(); \
81 #define SYS_NI(name) SYSCALL_ALIAS(__arm64_sys_##name, sys_ni_posix_timers);
83 #endif /* __ASM_SYSCALL_WRAPPER_H */