Home Home > GIT Browse
summaryrefslogtreecommitdiff
blob: 4cb1e7e4e561b82b5a4473ed6f60f87327055a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef _KLP_SYSCALLS_H
#define _KLP_SYSCALLS_H

#include <linux/version.h>
#include <linux/syscalls.h>

/*
 * For kernels after 4.17.0, syscalls' symbol names as constructed by
 * the kernel's __SYSCALL_DEFINEx macro depend on kernel version and
 * architecture.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
/* C.f. include/linux/syscalls.h */

#define KLP_SYSCALL_SYM(name) SyS_ ## name

#ifdef CONFIG_COMPAT
/* What comes out of COMPAT_SYSCALL_DEFINEx(). */
#define KLP_COMPAT_SYSCALL_SYM(name) compat_SyS_ ## name

#define KLP_SYSCALL_DECLx(x, sym, ...)			\
	asmlinkage long sym(__MAP(x,__SC_LONG,__VA_ARGS__))

#endif /* CONFIG_COMPAT */


#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) */


#if defined(CONFIG_X86_64)
/* C.f. arch/x86/include/asm/syscall_wrapper.h */
#define KLP_SYSCALL_SYM(name) __x64_sys_ ## name

#ifdef CONFIG_IA32_EMULATION
#define KLP_ARCH_HAS_SYSCALL_COMPAT_STUBS 1
/* Compat stub for common syscalls. */
#define KLP_SYSCALL_COMPAT_STUB_SYM(name) __ia32_sys_ ## name
#endif /* CONFIG_IA32_EMULATION */

#ifdef CONFIG_COMPAT
/* What comes out of COMPAT_SYSCALL_DEFINEx(). */
#define KLP_COMPAT_SYSCALL_SYM(name) __ia32_compat_sys_ ## name
#endif /* CONFIG_COMPAT */

#define KLP_SYSCALL_DECLx(x, sym, ...)			\
	asmlinkage long sym(const struct pt_regs *)


#elif defined(CONFIG_S390)
/* C.f. arch/s390/include/asm/syscall_wrapper.h */
#define KLP_SYSCALL_SYM(name) __s390x_sys_ ## name

#ifdef CONFIG_COMPAT
#define KLP_ARCH_HAS_SYSCALL_COMPAT_STUBS 1
/* Compat stub for common syscalls. */
#define KLP_SYSCALL_COMPAT_STUB_SYM(name) __s390_sys_ ## name
#define KLP_COMPAT_SYSCALL_SYM(name) __s390_compat_sys_ ## name
#endif /* CONFIG_COMPAT */

#define KLP_SYSCALL_DECLx(x, sym, ...)			\
	asmlinkage long sym(__MAP(x,__SC_LONG,__VA_ARGS__))


#else
/* C.f. include/linux/syscalls.h */
#define KLP_SYSCALL_SYM(name) __se_sys_ ## name

#ifdef CONFIG_COMPAT
#define KLP_COMPAT_SYSCALL_SYM(name) __se_compat_sys_ ## name
#endif /* CONFIG_COMPAT */

#define KLP_SYSCALL_DECLx(x, sym, ...)			\
	asmlinkage long sym(__MAP(x,__SC_LONG,__VA_ARGS__))


#endif

#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) */
#endif /* _KLP_SYSCALLS_H */