forked from luck/tmp_suning_uos_patched
a90f590a1b
Using this helper allows us to avoid the in-kernel calls to the sys_mmap_pgoff() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_mmap_pgoff(). This patch is part of a series which removes in-kernel calls to syscalls. On this basis, the syscall entry path can be streamlined. For details, see http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net Cc: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
66 lines
1.9 KiB
C
66 lines
1.9 KiB
C
/*
|
|
* 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>
|
|
#include <asm/cpufeature.h>
|
|
|
|
asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
|
|
unsigned long prot, unsigned long flags,
|
|
unsigned long fd, off_t off)
|
|
{
|
|
if (offset_in_page(off) != 0)
|
|
return -EINVAL;
|
|
|
|
return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
|
|
}
|
|
|
|
SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
|
|
{
|
|
if (personality(personality) == PER_LINUX32 &&
|
|
!system_supports_32bit_el0())
|
|
return -EINVAL;
|
|
return sys_personality(personality);
|
|
}
|
|
|
|
/*
|
|
* Wrappers to pass the pt_regs argument.
|
|
*/
|
|
asmlinkage long sys_rt_sigreturn_wrapper(void);
|
|
#define sys_rt_sigreturn sys_rt_sigreturn_wrapper
|
|
#define sys_personality sys_arm64_personality
|
|
|
|
#undef __SYSCALL
|
|
#define __SYSCALL(nr, sym) [nr] = sym,
|
|
|
|
/*
|
|
* The sys_call_table array must be 4K aligned to be accessible from
|
|
* kernel/entry.S.
|
|
*/
|
|
void * const sys_call_table[__NR_syscalls] __aligned(4096) = {
|
|
[0 ... __NR_syscalls - 1] = sys_ni_syscall,
|
|
#include <asm/unistd.h>
|
|
};
|