]>
Commit | Line | Data |
---|---|---|
3dd681d9 WD |
1 | /* |
2 | * Compat system call wrappers | |
3 | * | |
4 | * Copyright (C) 2012 ARM Ltd. | |
5 | * Authors: Will Deacon <will.deacon@arm.com> | |
6 | * Catalin Marinas <catalin.marinas@arm.com> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | */ | |
20 | ||
21 | #include <linux/linkage.h> | |
18ccb0ca | 22 | #include <linux/const.h> |
3dd681d9 WD |
23 | |
24 | #include <asm/assembler.h> | |
25 | #include <asm/asm-offsets.h> | |
18ccb0ca AS |
26 | #include <asm/errno.h> |
27 | #include <asm/page.h> | |
3dd681d9 WD |
28 | |
29 | /* | |
30 | * System call wrappers for the AArch32 compatibility layer. | |
31 | */ | |
3dd681d9 | 32 | |
0156411b | 33 | ENTRY(compat_sys_sigreturn_wrapper) |
3dd681d9 | 34 | mov x0, sp |
3dd681d9 WD |
35 | b compat_sys_sigreturn |
36 | ENDPROC(compat_sys_sigreturn_wrapper) | |
37 | ||
0156411b | 38 | ENTRY(compat_sys_rt_sigreturn_wrapper) |
3dd681d9 | 39 | mov x0, sp |
3dd681d9 WD |
40 | b compat_sys_rt_sigreturn |
41 | ENDPROC(compat_sys_rt_sigreturn_wrapper) | |
42 | ||
0156411b | 43 | ENTRY(compat_sys_statfs64_wrapper) |
3dd681d9 WD |
44 | mov w3, #84 |
45 | cmp w1, #88 | |
46 | csel w1, w3, w1, eq | |
47 | b compat_sys_statfs64 | |
48 | ENDPROC(compat_sys_statfs64_wrapper) | |
49 | ||
0156411b | 50 | ENTRY(compat_sys_fstatfs64_wrapper) |
3dd681d9 WD |
51 | mov w3, #84 |
52 | cmp w1, #88 | |
53 | csel w1, w3, w1, eq | |
54 | b compat_sys_fstatfs64 | |
55 | ENDPROC(compat_sys_fstatfs64_wrapper) | |
56 | ||
18ccb0ca AS |
57 | /* |
58 | * Note: off_4k (w5) is always in units of 4K. If we can't do the | |
59 | * requested offset because it is not page-aligned, we return -EINVAL. | |
60 | */ | |
61 | ENTRY(compat_sys_mmap2_wrapper) | |
62 | #if PAGE_SHIFT > 12 | |
63 | tst w5, #~PAGE_MASK >> 12 | |
64 | b.ne 1f | |
65 | lsr w5, w5, #PAGE_SHIFT - 12 | |
66 | #endif | |
67 | b sys_mmap_pgoff | |
68 | 1: mov x0, #-EINVAL | |
69 | ret | |
70 | ENDPROC(compat_sys_mmap2_wrapper) | |
71 | ||
3dd681d9 WD |
72 | /* |
73 | * Wrappers for AArch32 syscalls that either take 64-bit parameters | |
74 | * in registers or that take 32-bit parameters which require sign | |
75 | * extension. | |
76 | */ | |
0156411b | 77 | ENTRY(compat_sys_pread64_wrapper) |
55b89540 | 78 | regs_to_64 x3, x4, x5 |
3dd681d9 WD |
79 | b sys_pread64 |
80 | ENDPROC(compat_sys_pread64_wrapper) | |
81 | ||
0156411b | 82 | ENTRY(compat_sys_pwrite64_wrapper) |
55b89540 | 83 | regs_to_64 x3, x4, x5 |
3dd681d9 WD |
84 | b sys_pwrite64 |
85 | ENDPROC(compat_sys_pwrite64_wrapper) | |
86 | ||
0156411b | 87 | ENTRY(compat_sys_truncate64_wrapper) |
55b89540 | 88 | regs_to_64 x1, x2, x3 |
3dd681d9 WD |
89 | b sys_truncate |
90 | ENDPROC(compat_sys_truncate64_wrapper) | |
91 | ||
0156411b | 92 | ENTRY(compat_sys_ftruncate64_wrapper) |
55b89540 | 93 | regs_to_64 x1, x2, x3 |
3dd681d9 WD |
94 | b sys_ftruncate |
95 | ENDPROC(compat_sys_ftruncate64_wrapper) | |
96 | ||
0156411b | 97 | ENTRY(compat_sys_readahead_wrapper) |
55b89540 | 98 | regs_to_64 x1, x2, x3 |
3dd681d9 WD |
99 | mov w2, w4 |
100 | b sys_readahead | |
101 | ENDPROC(compat_sys_readahead_wrapper) | |
102 | ||
0156411b | 103 | ENTRY(compat_sys_fadvise64_64_wrapper) |
3dd681d9 | 104 | mov w6, w1 |
55b89540 ML |
105 | regs_to_64 x1, x2, x3 |
106 | regs_to_64 x2, x4, x5 | |
3dd681d9 WD |
107 | mov w3, w6 |
108 | b sys_fadvise64_64 | |
109 | ENDPROC(compat_sys_fadvise64_64_wrapper) | |
110 | ||
0156411b | 111 | ENTRY(compat_sys_sync_file_range2_wrapper) |
55b89540 ML |
112 | regs_to_64 x2, x2, x3 |
113 | regs_to_64 x3, x4, x5 | |
3dd681d9 WD |
114 | b sys_sync_file_range2 |
115 | ENDPROC(compat_sys_sync_file_range2_wrapper) | |
116 | ||
0156411b | 117 | ENTRY(compat_sys_fallocate_wrapper) |
55b89540 ML |
118 | regs_to_64 x2, x2, x3 |
119 | regs_to_64 x3, x4, x5 | |
3dd681d9 WD |
120 | b sys_fallocate |
121 | ENDPROC(compat_sys_fallocate_wrapper) |