From 2c3c1048746a4622d8c89a29670120dc8fab93c4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:49:45 +0200 Subject: Adding upstream version 6.1.76. Signed-off-by: Daniel Baumann --- arch/nios2/kernel/sys_nios2.c | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 arch/nios2/kernel/sys_nios2.c (limited to 'arch/nios2/kernel/sys_nios2.c') diff --git a/arch/nios2/kernel/sys_nios2.c b/arch/nios2/kernel/sys_nios2.c new file mode 100644 index 000000000..b1ca85699 --- /dev/null +++ b/arch/nios2/kernel/sys_nios2.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2013 Altera Corporation + * Copyright (C) 2011-2012 Tobias Klauser + * 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 +#include +#include +#include +#include + +#include +#include + +/* sys_cacheflush -- flush the processor cache. */ +asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, + unsigned int op) +{ + struct vm_area_struct *vma; + struct mm_struct *mm = current->mm; + + 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; + + if (mmap_read_lock_killable(mm)) + return -EINTR; + + /* + * Verify that the specified address region actually belongs + * to this process. + */ + vma = find_vma(mm, addr); + if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) { + mmap_read_unlock(mm); + return -EFAULT; + } + + flush_cache_range(vma, addr, addr + len); + + mmap_read_unlock(mm); + return 0; +} + +asmlinkage int sys_getpagesize(void) +{ + return PAGE_SIZE; +} -- cgit v1.2.3