sys.c 2.0 KB
Newer Older
C
Catalin Marinas 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*
 * AArch64-specific system calls implementation
 *
 * Copyright (C) 2012 ARM Ltd.
 * Author: Catalin Marinas <catalin.marinas@arm.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/export.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/syscalls.h>
M
Mark Rutland 已提交
28

29
#include <asm/cpufeature.h>
M
Mark Rutland 已提交
30
#include <asm/syscall.h>
C
Catalin Marinas 已提交
31

32 33 34
SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
		unsigned long, prot, unsigned long, flags,
		unsigned long, fd, off_t, off)
C
Catalin Marinas 已提交
35 36 37 38
{
	if (offset_in_page(off) != 0)
		return -EINVAL;

39
	return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
C
Catalin Marinas 已提交
40 41
}

42 43 44 45 46
SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
{
	if (personality(personality) == PER_LINUX32 &&
		!system_supports_32bit_el0())
		return -EINVAL;
47
	return ksys_personality(personality);
48 49
}

C
Catalin Marinas 已提交
50 51 52
/*
 * Wrappers to pass the pt_regs argument.
 */
53
#define sys_personality		sys_arm64_personality
C
Catalin Marinas 已提交
54

M
Mark Rutland 已提交
55 56 57 58 59 60 61
asmlinkage long sys_ni_syscall(const struct pt_regs *);
#define __arm64_sys_ni_syscall	sys_ni_syscall

#undef __SYSCALL
#define __SYSCALL(nr, sym)	asmlinkage long __arm64_##sym(const struct pt_regs *);
#include <asm/unistd.h>

C
Catalin Marinas 已提交
62
#undef __SYSCALL
M
Mark Rutland 已提交
63
#define __SYSCALL(nr, sym)	[nr] = (syscall_fn_t)__arm64_##sym,
C
Catalin Marinas 已提交
64

65
const syscall_fn_t sys_call_table[__NR_syscalls] = {
M
Mark Rutland 已提交
66
	[0 ... __NR_syscalls - 1] = (syscall_fn_t)sys_ni_syscall,
C
Catalin Marinas 已提交
67 68
#include <asm/unistd.h>
};