Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * AArch64-specific system calls implementation
0004  *
0005  * Copyright (C) 2012 ARM Ltd.
0006  * Author: Catalin Marinas <catalin.marinas@arm.com>
0007  */
0008 
0009 #include <linux/compiler.h>
0010 #include <linux/errno.h>
0011 #include <linux/fs.h>
0012 #include <linux/mm.h>
0013 #include <linux/export.h>
0014 #include <linux/sched.h>
0015 #include <linux/slab.h>
0016 #include <linux/syscalls.h>
0017 
0018 #include <asm/cpufeature.h>
0019 #include <asm/syscall.h>
0020 
0021 SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
0022         unsigned long, prot, unsigned long, flags,
0023         unsigned long, fd, unsigned long, off)
0024 {
0025     if (offset_in_page(off) != 0)
0026         return -EINVAL;
0027 
0028     return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
0029 }
0030 
0031 SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
0032 {
0033     if (personality(personality) == PER_LINUX32 &&
0034         !system_supports_32bit_el0())
0035         return -EINVAL;
0036     return ksys_personality(personality);
0037 }
0038 
0039 asmlinkage long sys_ni_syscall(void);
0040 
0041 asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused)
0042 {
0043     return sys_ni_syscall();
0044 }
0045 
0046 /*
0047  * Wrappers to pass the pt_regs argument.
0048  */
0049 #define __arm64_sys_personality     __arm64_sys_arm64_personality
0050 
0051 #undef __SYSCALL
0052 #define __SYSCALL(nr, sym)  asmlinkage long __arm64_##sym(const struct pt_regs *);
0053 #include <asm/unistd.h>
0054 
0055 #undef __SYSCALL
0056 #define __SYSCALL(nr, sym)  [nr] = __arm64_##sym,
0057 
0058 const syscall_fn_t sys_call_table[__NR_syscalls] = {
0059     [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall,
0060 #include <asm/unistd.h>
0061 };