0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #define __COMPAT_SYSCALL_NR
0013
0014 #include <linux/compat.h>
0015 #include <linux/compiler.h>
0016 #include <linux/syscalls.h>
0017
0018 #include <asm/syscall.h>
0019
0020 asmlinkage long compat_sys_sigreturn(void);
0021 asmlinkage long compat_sys_rt_sigreturn(void);
0022
0023 COMPAT_SYSCALL_DEFINE3(aarch32_statfs64, const char __user *, pathname,
0024 compat_size_t, sz, struct compat_statfs64 __user *, buf)
0025 {
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 if (sz == 88)
0036 sz = 84;
0037
0038 return kcompat_sys_statfs64(pathname, sz, buf);
0039 }
0040
0041 COMPAT_SYSCALL_DEFINE3(aarch32_fstatfs64, unsigned int, fd, compat_size_t, sz,
0042 struct compat_statfs64 __user *, buf)
0043 {
0044
0045 if (sz == 88)
0046 sz = 84;
0047
0048 return kcompat_sys_fstatfs64(fd, sz, buf);
0049 }
0050
0051
0052
0053
0054
0055 COMPAT_SYSCALL_DEFINE6(aarch32_mmap2, unsigned long, addr, unsigned long, len,
0056 unsigned long, prot, unsigned long, flags,
0057 unsigned long, fd, unsigned long, off_4k)
0058 {
0059 if (off_4k & (~PAGE_MASK >> 12))
0060 return -EINVAL;
0061
0062 off_4k >>= (PAGE_SHIFT - 12);
0063
0064 return ksys_mmap_pgoff(addr, len, prot, flags, fd, off_4k);
0065 }
0066
0067 #ifdef CONFIG_CPU_BIG_ENDIAN
0068 #define arg_u32p(name) u32, name##_hi, u32, name##_lo
0069 #else
0070 #define arg_u32p(name) u32, name##_lo, u32, name##_hi
0071 #endif
0072
0073 #define arg_u64(name) (((u64)name##_hi << 32) | name##_lo)
0074
0075 COMPAT_SYSCALL_DEFINE6(aarch32_pread64, unsigned int, fd, char __user *, buf,
0076 size_t, count, u32, __pad, arg_u32p(pos))
0077 {
0078 return ksys_pread64(fd, buf, count, arg_u64(pos));
0079 }
0080
0081 COMPAT_SYSCALL_DEFINE6(aarch32_pwrite64, unsigned int, fd,
0082 const char __user *, buf, size_t, count, u32, __pad,
0083 arg_u32p(pos))
0084 {
0085 return ksys_pwrite64(fd, buf, count, arg_u64(pos));
0086 }
0087
0088 COMPAT_SYSCALL_DEFINE4(aarch32_truncate64, const char __user *, pathname,
0089 u32, __pad, arg_u32p(length))
0090 {
0091 return ksys_truncate(pathname, arg_u64(length));
0092 }
0093
0094 COMPAT_SYSCALL_DEFINE4(aarch32_ftruncate64, unsigned int, fd, u32, __pad,
0095 arg_u32p(length))
0096 {
0097 return ksys_ftruncate(fd, arg_u64(length));
0098 }
0099
0100 COMPAT_SYSCALL_DEFINE5(aarch32_readahead, int, fd, u32, __pad,
0101 arg_u32p(offset), size_t, count)
0102 {
0103 return ksys_readahead(fd, arg_u64(offset), count);
0104 }
0105
0106 COMPAT_SYSCALL_DEFINE6(aarch32_fadvise64_64, int, fd, int, advice,
0107 arg_u32p(offset), arg_u32p(len))
0108 {
0109 return ksys_fadvise64_64(fd, arg_u64(offset), arg_u64(len), advice);
0110 }
0111
0112 COMPAT_SYSCALL_DEFINE6(aarch32_sync_file_range2, int, fd, unsigned int, flags,
0113 arg_u32p(offset), arg_u32p(nbytes))
0114 {
0115 return ksys_sync_file_range(fd, arg_u64(offset), arg_u64(nbytes),
0116 flags);
0117 }
0118
0119 COMPAT_SYSCALL_DEFINE6(aarch32_fallocate, int, fd, int, mode,
0120 arg_u32p(offset), arg_u32p(len))
0121 {
0122 return ksys_fallocate(fd, mode, arg_u64(offset), arg_u64(len));
0123 }
0124
0125 #undef __SYSCALL
0126 #define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
0127 #include <asm/unistd32.h>
0128
0129 #undef __SYSCALL
0130 #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
0131
0132 const syscall_fn_t compat_sys_call_table[__NR_compat_syscalls] = {
0133 [0 ... __NR_compat_syscalls - 1] = __arm64_sys_ni_syscall,
0134 #include <asm/unistd32.h>
0135 };