diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-12-12 08:09:03 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-12-12 08:09:03 (GMT) |
commit | 3459f0d78ffe27a1b341c22eb158b622eaaea3fc (patch) | |
tree | 715b0575eec541d0181876ad367ca5480cdcecf3 /arch/nios2/kernel/sys_nios2.c | |
parent | 9fc81d87420d0d3fd62d5e5529972c0ad9eab9cc (diff) | |
parent | bee2782f30f66898be3f74ad02e4d1f87a969694 (diff) | |
download | linux-3459f0d78ffe27a1b341c22eb158b622eaaea3fc.tar.xz |
Merge branch 'linus' into perf/urgent, to pick up the upstream merged bits
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/nios2/kernel/sys_nios2.c')
-rw-r--r-- | arch/nios2/kernel/sys_nios2.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/nios2/kernel/sys_nios2.c b/arch/nios2/kernel/sys_nios2.c new file mode 100644 index 0000000..cd390ec --- /dev/null +++ b/arch/nios2/kernel/sys_nios2.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2013 Altera Corporation + * Copyright (C) 2011-2012 Tobias Klauser <tklauser@distanz.ch> + * Copyright (C) 2004 Microtronix Datacom Ltd. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include <linux/export.h> +#include <linux/file.h> +#include <linux/fs.h> +#include <linux/slab.h> +#include <linux/syscalls.h> + +#include <asm/cacheflush.h> +#include <asm/traps.h> + +/* sys_cacheflush -- flush the processor cache. */ +asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, + unsigned int op) +{ + struct vm_area_struct *vma; + + if (len == 0) + return 0; + + /* We only support op 0 now, return error if op is non-zero.*/ + if (op) + return -EINVAL; + + /* Check for overflow */ + if (addr + len < addr) + return -EFAULT; + + /* + * Verify that the specified address region actually belongs + * to this process. + */ + vma = find_vma(current->mm, addr); + if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) + return -EFAULT; + + flush_cache_range(vma, addr, addr + len); + + return 0; +} + +asmlinkage int sys_getpagesize(void) +{ + return PAGE_SIZE; +} |