blob: d5ffaaab31a7d1ed433e8e7bf01ae1f52848cd22 [file] [log] [blame]
Thomas Gleixnercaab2772019-06-03 07:44:50 +02001// SPDX-License-Identifier: GPL-2.0-only
Catalin Marinas7992d602012-03-05 11:49:31 +00002/*
3 * AArch64-specific system calls implementation
4 *
5 * Copyright (C) 2012 ARM Ltd.
6 * Author: Catalin Marinas <catalin.marinas@arm.com>
Catalin Marinas7992d602012-03-05 11:49:31 +00007 */
8
9#include <linux/compiler.h>
10#include <linux/errno.h>
11#include <linux/fs.h>
12#include <linux/mm.h>
13#include <linux/export.h>
14#include <linux/sched.h>
15#include <linux/slab.h>
16#include <linux/syscalls.h>
Mark Rutland27d83e62018-07-11 14:56:42 +010017
Suzuki K Poulose643d7032016-04-18 10:28:37 +010018#include <asm/cpufeature.h>
Mark Rutland27d83e62018-07-11 14:56:42 +010019#include <asm/syscall.h>
Catalin Marinas7992d602012-03-05 11:49:31 +000020
Mark Rutlandd3516c92018-07-11 14:56:54 +010021SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
22 unsigned long, prot, unsigned long, flags,
Boyang Zhouf08cae22019-04-29 15:27:19 +010023 unsigned long, fd, unsigned long, off)
Catalin Marinas7992d602012-03-05 11:49:31 +000024{
25 if (offset_in_page(off) != 0)
26 return -EINVAL;
27
Dominik Brodowskia90f5902018-03-11 11:34:46 +010028 return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
Catalin Marinas7992d602012-03-05 11:49:31 +000029}
30
Suzuki K Poulose643d7032016-04-18 10:28:37 +010031SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
32{
33 if (personality(personality) == PER_LINUX32 &&
34 !system_supports_32bit_el0())
35 return -EINVAL;
Mark Rutland3f7decc2018-07-11 14:56:52 +010036 return ksys_personality(personality);
Suzuki K Poulose643d7032016-04-18 10:28:37 +010037}
38
Sami Tolvanen1e29ab32019-05-24 15:11:18 -070039asmlinkage long sys_ni_syscall(void);
40
41asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused)
42{
43 return sys_ni_syscall();
44}
45
Catalin Marinas7992d602012-03-05 11:49:31 +000046/*
47 * Wrappers to pass the pt_regs argument.
48 */
Catalin Marinas00377272019-05-28 12:39:34 +010049#define __arm64_sys_personality __arm64_sys_arm64_personality
Catalin Marinas7992d602012-03-05 11:49:31 +000050
Catalin Marinas7992d602012-03-05 11:49:31 +000051#undef __SYSCALL
Mark Rutland4378a7d2018-07-11 14:56:56 +010052#define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
53#include <asm/unistd.h>
54
55#undef __SYSCALL
Sami Tolvanen1e29ab32019-05-24 15:11:18 -070056#define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
Catalin Marinas7992d602012-03-05 11:49:31 +000057
Mark Rutland80d63bc2018-07-11 14:56:49 +010058const syscall_fn_t sys_call_table[__NR_syscalls] = {
Sami Tolvanen1e29ab32019-05-24 15:11:18 -070059 [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall,
Catalin Marinas7992d602012-03-05 11:49:31 +000060#include <asm/unistd.h>
61};