diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2015-01-06 11:42:32 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-01-27 04:38:07 -0500 |
commit | 0156411b1828771c09c92f034e7b81f702b84f07 (patch) | |
tree | a0c06d493a7e852ed9e736c42be740927c21094d /arch/arm64/kernel/sys32.c | |
parent | 54e45c169dbce43cf46d00eb1521b655b6e4f9e9 (diff) |
arm64: Implement the compat_sys_call_table in C
Unlike the sys_call_table[], the compat one was implemented in sys32.S
making it impossible to notice discrepancies between the number of
compat syscalls and the __NR_compat_syscalls macro, the latter having to
be defined in asm/unistd.h as including asm/unistd32.h would cause
conflicts on __NR_* definitions. With this patch, incorrect
__NR_compat_syscalls values will result in a build-time error.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Diffstat (limited to 'arch/arm64/kernel/sys32.c')
-rw-r--r-- | arch/arm64/kernel/sys32.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c new file mode 100644 index 000000000000..2d5ab3c90b82 --- /dev/null +++ b/arch/arm64/kernel/sys32.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * arch/arm64/kernel/sys32.c | ||
3 | * | ||
4 | * Copyright (C) 2015 ARM Ltd. | ||
5 | * | ||
6 | * This program is free software(void); you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http(void);//www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * Needed to avoid conflicting __NR_* macros between uapi/asm/unistd.h and | ||
21 | * asm/unistd32.h. | ||
22 | */ | ||
23 | #define __COMPAT_SYSCALL_NR | ||
24 | |||
25 | #include <linux/compiler.h> | ||
26 | #include <linux/syscalls.h> | ||
27 | |||
28 | asmlinkage long compat_sys_sigreturn_wrapper(void); | ||
29 | asmlinkage long compat_sys_rt_sigreturn_wrapper(void); | ||
30 | asmlinkage long compat_sys_statfs64_wrapper(void); | ||
31 | asmlinkage long compat_sys_fstatfs64_wrapper(void); | ||
32 | asmlinkage long compat_sys_pread64_wrapper(void); | ||
33 | asmlinkage long compat_sys_pwrite64_wrapper(void); | ||
34 | asmlinkage long compat_sys_truncate64_wrapper(void); | ||
35 | asmlinkage long compat_sys_ftruncate64_wrapper(void); | ||
36 | asmlinkage long compat_sys_readahead_wrapper(void); | ||
37 | asmlinkage long compat_sys_fadvise64_64_wrapper(void); | ||
38 | asmlinkage long compat_sys_sync_file_range2_wrapper(void); | ||
39 | asmlinkage long compat_sys_fallocate_wrapper(void); | ||
40 | |||
41 | #undef __SYSCALL | ||
42 | #define __SYSCALL(nr, sym) [nr] = sym, | ||
43 | |||
44 | /* | ||
45 | * The sys_call_table array must be 4K aligned to be accessible from | ||
46 | * kernel/entry.S. | ||
47 | */ | ||
48 | void * const compat_sys_call_table[__NR_compat_syscalls] __aligned(4096) = { | ||
49 | [0 ... __NR_compat_syscalls - 1] = sys_ni_syscall, | ||
50 | #include <asm/unistd32.h> | ||
51 | }; | ||