dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / arch / nds32 / kernel / sys_nds32.c
blob0835277636ce31f1a3ba75dbbcd33a7d0f0d31eb
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
4 #include <linux/syscalls.h>
5 #include <linux/uaccess.h>
7 #include <asm/cachectl.h>
8 #include <asm/proc-fns.h>
9 #include <asm/udftrap.h>
10 #include <asm/fpu.h>
12 SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
13 unsigned long, prot, unsigned long, flags,
14 unsigned long, fd, unsigned long, pgoff)
16 if (pgoff & (~PAGE_MASK >> 12))
17 return -EINVAL;
19 return sys_mmap_pgoff(addr, len, prot, flags, fd,
20 pgoff >> (PAGE_SHIFT - 12));
23 SYSCALL_DEFINE4(fadvise64_64_wrapper,int, fd, int, advice, loff_t, offset,
24 loff_t, len)
26 return sys_fadvise64_64(fd, offset, len, advice);
29 SYSCALL_DEFINE3(cacheflush, unsigned int, start, unsigned int, end, int, cache)
31 struct vm_area_struct *vma;
32 bool flushi = true, wbd = true;
34 vma = find_vma(current->mm, start);
35 if (!vma)
36 return -EFAULT;
37 switch (cache) {
38 case ICACHE:
39 wbd = false;
40 break;
41 case DCACHE:
42 flushi = false;
43 break;
44 case BCACHE:
45 break;
46 default:
47 return -EINVAL;
49 cpu_cache_wbinval_range_check(vma, start, end, flushi, wbd);
51 return 0;
54 SYSCALL_DEFINE1(udftrap, int, option)
56 #if IS_ENABLED(CONFIG_SUPPORT_DENORMAL_ARITHMETIC)
57 int old_udftrap;
59 if (!used_math()) {
60 load_fpu(&init_fpuregs);
61 current->thread.fpu.UDF_trap = init_fpuregs.UDF_trap;
62 set_used_math();
65 old_udftrap = current->thread.fpu.UDF_trap;
66 switch (option) {
67 case DISABLE_UDFTRAP:
68 current->thread.fpu.UDF_trap = 0;
69 break;
70 case ENABLE_UDFTRAP:
71 current->thread.fpu.UDF_trap = FPCSR_mskUDFE;
72 break;
73 case GET_UDFTRAP:
74 break;
75 default:
76 return -EINVAL;
78 return old_udftrap;
79 #else
80 return -ENOTSUPP;
81 #endif