Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 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> |
| 22 | |
| 23 | #include <asm/assembler.h> |
| 24 | #include <asm/asm-offsets.h> |
| 25 | |
| 26 | /* |
| 27 | * System call wrappers for the AArch32 compatibility layer. |
| 28 | */ |
Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 29 | |
| 30 | compat_sys_sigreturn_wrapper: |
| 31 | mov x0, sp |
| 32 | mov x27, #0 // prevent syscall restart handling (why) |
| 33 | b compat_sys_sigreturn |
| 34 | ENDPROC(compat_sys_sigreturn_wrapper) |
| 35 | |
| 36 | compat_sys_rt_sigreturn_wrapper: |
| 37 | mov x0, sp |
| 38 | mov x27, #0 // prevent syscall restart handling (why) |
| 39 | b compat_sys_rt_sigreturn |
| 40 | ENDPROC(compat_sys_rt_sigreturn_wrapper) |
| 41 | |
Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 42 | compat_sys_statfs64_wrapper: |
| 43 | mov w3, #84 |
| 44 | cmp w1, #88 |
| 45 | csel w1, w3, w1, eq |
| 46 | b compat_sys_statfs64 |
| 47 | ENDPROC(compat_sys_statfs64_wrapper) |
| 48 | |
| 49 | compat_sys_fstatfs64_wrapper: |
| 50 | mov w3, #84 |
| 51 | cmp w1, #88 |
| 52 | csel w1, w3, w1, eq |
| 53 | b compat_sys_fstatfs64 |
| 54 | ENDPROC(compat_sys_fstatfs64_wrapper) |
| 55 | |
| 56 | /* |
| 57 | * Wrappers for AArch32 syscalls that either take 64-bit parameters |
| 58 | * in registers or that take 32-bit parameters which require sign |
| 59 | * extension. |
| 60 | */ |
Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 61 | compat_sys_pread64_wrapper: |
| 62 | orr x3, x4, x5, lsl #32 |
| 63 | b sys_pread64 |
| 64 | ENDPROC(compat_sys_pread64_wrapper) |
| 65 | |
| 66 | compat_sys_pwrite64_wrapper: |
| 67 | orr x3, x4, x5, lsl #32 |
| 68 | b sys_pwrite64 |
| 69 | ENDPROC(compat_sys_pwrite64_wrapper) |
| 70 | |
| 71 | compat_sys_truncate64_wrapper: |
| 72 | orr x1, x2, x3, lsl #32 |
| 73 | b sys_truncate |
| 74 | ENDPROC(compat_sys_truncate64_wrapper) |
| 75 | |
| 76 | compat_sys_ftruncate64_wrapper: |
| 77 | orr x1, x2, x3, lsl #32 |
| 78 | b sys_ftruncate |
| 79 | ENDPROC(compat_sys_ftruncate64_wrapper) |
| 80 | |
| 81 | compat_sys_readahead_wrapper: |
| 82 | orr x1, x2, x3, lsl #32 |
| 83 | mov w2, w4 |
| 84 | b sys_readahead |
| 85 | ENDPROC(compat_sys_readahead_wrapper) |
| 86 | |
Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 87 | compat_sys_fadvise64_64_wrapper: |
| 88 | mov w6, w1 |
| 89 | orr x1, x2, x3, lsl #32 |
| 90 | orr x2, x4, x5, lsl #32 |
| 91 | mov w3, w6 |
| 92 | b sys_fadvise64_64 |
| 93 | ENDPROC(compat_sys_fadvise64_64_wrapper) |
| 94 | |
| 95 | compat_sys_sync_file_range2_wrapper: |
| 96 | orr x2, x2, x3, lsl #32 |
| 97 | orr x3, x4, x5, lsl #32 |
| 98 | b sys_sync_file_range2 |
| 99 | ENDPROC(compat_sys_sync_file_range2_wrapper) |
| 100 | |
| 101 | compat_sys_fallocate_wrapper: |
| 102 | orr x2, x2, x3, lsl #32 |
| 103 | orr x3, x4, x5, lsl #32 |
| 104 | b sys_fallocate |
| 105 | ENDPROC(compat_sys_fallocate_wrapper) |
| 106 | |
Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 107 | #undef __SYSCALL |
| 108 | #define __SYSCALL(x, y) .quad y // x |
Will Deacon | 3dd681d | 2012-03-05 11:49:32 +0000 | [diff] [blame] | 109 | |
| 110 | /* |
| 111 | * The system calls table must be 4KB aligned. |
| 112 | */ |
| 113 | .align 12 |
| 114 | ENTRY(compat_sys_call_table) |
Catalin Marinas | f3d447a | 2012-10-10 15:27:04 +0100 | [diff] [blame] | 115 | #include <asm/unistd32.h> |