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>
10 #include <asm/fp_udfiex_crtl.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))
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
,
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
);
49 cpu_cache_wbinval_range_check(vma
, start
, end
, flushi
, wbd
);
54 SYSCALL_DEFINE2(fp_udfiex_crtl
, unsigned int, cmd
, unsigned int, act
)
56 #if IS_ENABLED(CONFIG_SUPPORT_DENORMAL_ARITHMETIC)
60 load_fpu(&init_fpuregs
);
61 current
->thread
.fpu
.UDF_IEX_trap
= init_fpuregs
.UDF_IEX_trap
;
65 old_udf_iex
= current
->thread
.fpu
.UDF_IEX_trap
;
66 act
&= (FPCSR_mskUDFE
| FPCSR_mskIEXE
);
69 case DISABLE_UDF_IEX_TRAP
:
70 current
->thread
.fpu
.UDF_IEX_trap
&= ~act
;
72 case ENABLE_UDF_IEX_TRAP
:
73 current
->thread
.fpu
.UDF_IEX_trap
|= act
;
75 case GET_UDF_IEX_TRAP
: