summaryrefslogtreecommitdiffstats
path: root/arch/nds32/kernel/sys_nds32.c
diff options
context:
space:
mode:
authorGreentime Hu <greentime@andestech.com>2017-10-25 04:37:49 +0200
committerGreentime Hu <greentime@andestech.com>2018-02-22 03:44:33 +0100
commit1932fbe36e02f54223ac4c6779b92269ca8b9b60 (patch)
tree03ef88dfb3d20281319075f94d970ebf6da87bb5 /arch/nds32/kernel/sys_nds32.c
parentnds32: ELF definitions (diff)
downloadlinux-1932fbe36e02f54223ac4c6779b92269ca8b9b60.tar.xz
linux-1932fbe36e02f54223ac4c6779b92269ca8b9b60.zip
nds32: System calls handling
This patch adds support for system calls. Signed-off-by: Vincent Chen <vincentc@andestech.com> Signed-off-by: Greentime Hu <greentime@andestech.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/nds32/kernel/sys_nds32.c')
-rw-r--r--arch/nds32/kernel/sys_nds32.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/nds32/kernel/sys_nds32.c b/arch/nds32/kernel/sys_nds32.c
new file mode 100644
index 000000000000..9de93ab4c52b
--- /dev/null
+++ b/arch/nds32/kernel/sys_nds32.c
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#include <linux/syscalls.h>
+#include <linux/uaccess.h>
+
+#include <asm/cachectl.h>
+#include <asm/proc-fns.h>
+
+SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
+ unsigned long, prot, unsigned long, flags,
+ unsigned long, fd, unsigned long, pgoff)
+{
+ if (pgoff & (~PAGE_MASK >> 12))
+ return -EINVAL;
+
+ return sys_mmap_pgoff(addr, len, prot, flags, fd,
+ pgoff >> (PAGE_SHIFT - 12));
+}
+
+SYSCALL_DEFINE4(fadvise64_64_wrapper,int, fd, int, advice, loff_t, offset,
+ loff_t, len)
+{
+ return sys_fadvise64_64(fd, offset, len, advice);
+}
+
+SYSCALL_DEFINE3(cacheflush, unsigned int, start, unsigned int, end, int, cache)
+{
+ struct vm_area_struct *vma;
+ bool flushi = true, wbd = true;
+
+ vma = find_vma(current->mm, start);
+ if (!vma)
+ return -EFAULT;
+ switch (cache) {
+ case ICACHE:
+ wbd = false;
+ break;
+ case DCACHE:
+ flushi = false;
+ break;
+ case BCACHE:
+ break;
+ default:
+ return -EINVAL;
+ }
+ cpu_cache_wbinval_range_check(vma, start, end, flushi, wbd);
+
+ return 0;
+}