2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2011-2012 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/export.h>
12 #include <linux/file.h>
14 #include <linux/slab.h>
15 #include <linux/syscalls.h>
17 #include <asm/cacheflush.h>
18 #include <asm/traps.h>
20 /* sys_cacheflush -- flush the processor cache. */
21 asmlinkage
int sys_cacheflush(unsigned long addr
, unsigned long len
,
24 struct vm_area_struct
*vma
;
25 struct mm_struct
*mm
= current
->mm
;
30 /* We only support op 0 now, return error if op is non-zero.*/
34 /* Check for overflow */
35 if (addr
+ len
< addr
)
38 if (mmap_read_lock_killable(mm
))
42 * Verify that the specified address region actually belongs
45 vma
= find_vma(mm
, addr
);
46 if (vma
== NULL
|| addr
< vma
->vm_start
|| addr
+ len
> vma
->vm_end
) {
51 flush_cache_range(vma
, addr
, addr
+ len
);
57 asmlinkage
int sys_getpagesize(void)