2012-03-05 18:49:31 +07:00
|
|
|
/*
|
|
|
|
* 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>
|
2018-07-11 20:56:42 +07:00
|
|
|
|
2016-04-18 16:28:37 +07:00
|
|
|
#include <asm/cpufeature.h>
|
2018-07-11 20:56:42 +07:00
|
|
|
#include <asm/syscall.h>
|
2012-03-05 18:49:31 +07:00
|
|
|
|
2018-07-11 20:56:54 +07:00
|
|
|
SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
|
|
|
|
unsigned long, prot, unsigned long, flags,
|
|
|
|
unsigned long, fd, off_t, off)
|
2012-03-05 18:49:31 +07:00
|
|
|
{
|
|
|
|
if (offset_in_page(off) != 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2018-03-11 17:34:46 +07:00
|
|
|
return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
|
2012-03-05 18:49:31 +07:00
|
|
|
}
|
|
|
|
|
2016-04-18 16:28:37 +07:00
|
|
|
SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
|
|
|
|
{
|
|
|
|
if (personality(personality) == PER_LINUX32 &&
|
|
|
|
!system_supports_32bit_el0())
|
|
|
|
return -EINVAL;
|
2018-07-11 20:56:52 +07:00
|
|
|
return ksys_personality(personality);
|
2016-04-18 16:28:37 +07:00
|
|
|
}
|
|
|
|
|
2012-03-05 18:49:31 +07:00
|
|
|
/*
|
|
|
|
* Wrappers to pass the pt_regs argument.
|
|
|
|
*/
|
2018-07-11 20:56:41 +07:00
|
|
|
asmlinkage long sys_rt_sigreturn(void);
|
2016-04-18 16:28:37 +07:00
|
|
|
#define sys_personality sys_arm64_personality
|
2012-03-05 18:49:31 +07:00
|
|
|
|
|
|
|
#undef __SYSCALL
|
2018-07-11 20:56:42 +07:00
|
|
|
#define __SYSCALL(nr, sym) [nr] = (syscall_fn_t)sym,
|
2012-03-05 18:49:31 +07:00
|
|
|
|
2018-07-11 20:56:49 +07:00
|
|
|
const syscall_fn_t sys_call_table[__NR_syscalls] = {
|
2018-07-11 20:56:42 +07:00
|
|
|
[0 ... __NR_syscalls - 1] = (syscall_fn_t)sys_ni_syscall,
|
2012-03-05 18:49:31 +07:00
|
|
|
#include <asm/unistd.h>
|
|
|
|
};
|