blob: 31045f3fed924a009dcbc5d72bae9da49f163990 [file] [log] [blame]
Catalin Marinas7992d602012-03-05 11:49:31 +00001/*
2 * AArch64-specific system calls implementation
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/compiler.h>
21#include <linux/errno.h>
22#include <linux/fs.h>
23#include <linux/mm.h>
24#include <linux/export.h>
25#include <linux/sched.h>
26#include <linux/slab.h>
27#include <linux/syscalls.h>
Suzuki K Poulose643d7032016-04-18 10:28:37 +010028#include <asm/cpufeature.h>
Catalin Marinas7992d602012-03-05 11:49:31 +000029
Catalin Marinas7992d602012-03-05 11:49:31 +000030asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
31 unsigned long prot, unsigned long flags,
32 unsigned long fd, off_t off)
33{
34 if (offset_in_page(off) != 0)
35 return -EINVAL;
36
Dominik Brodowskia90f5902018-03-11 11:34:46 +010037 return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
Catalin Marinas7992d602012-03-05 11:49:31 +000038}
39
Suzuki K Poulose643d7032016-04-18 10:28:37 +010040SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
41{
42 if (personality(personality) == PER_LINUX32 &&
43 !system_supports_32bit_el0())
44 return -EINVAL;
45 return sys_personality(personality);
46}
47
Catalin Marinas7992d602012-03-05 11:49:31 +000048/*
49 * Wrappers to pass the pt_regs argument.
50 */
Mark Rutland3085e162018-07-11 14:56:41 +010051asmlinkage long sys_rt_sigreturn(void);
Suzuki K Poulose643d7032016-04-18 10:28:37 +010052#define sys_personality sys_arm64_personality
Catalin Marinas7992d602012-03-05 11:49:31 +000053
Catalin Marinas7992d602012-03-05 11:49:31 +000054#undef __SYSCALL
55#define __SYSCALL(nr, sym) [nr] = sym,
56
57/*
58 * The sys_call_table array must be 4K aligned to be accessible from
59 * kernel/entry.S.
60 */
Mark Rutlandc623b332015-01-08 11:42:59 +000061void * const sys_call_table[__NR_syscalls] __aligned(4096) = {
Catalin Marinas7992d602012-03-05 11:49:31 +000062 [0 ... __NR_syscalls - 1] = sys_ni_syscall,
63#include <asm/unistd.h>
64};