~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/kernel/sys_sh.c

Version: ~ [ linux-5.13-rc5 ] ~ [ linux-5.12.9 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.42 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.124 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.193 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.235 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.271 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.271 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/arch/sh/kernel/sys_sh.c
  3  *
  4  * This file contains various random system calls that
  5  * have a non-standard calling sequence on the Linux/SuperH
  6  * platform.
  7  *
  8  * Taken from i386 version.
  9  */
 10 #include <linux/errno.h>
 11 #include <linux/sched.h>
 12 #include <linux/mm.h>
 13 #include <linux/smp.h>
 14 #include <linux/sem.h>
 15 #include <linux/msg.h>
 16 #include <linux/shm.h>
 17 #include <linux/stat.h>
 18 #include <linux/syscalls.h>
 19 #include <linux/mman.h>
 20 #include <linux/file.h>
 21 #include <linux/utsname.h>
 22 #include <linux/module.h>
 23 #include <linux/fs.h>
 24 #include <linux/ipc.h>
 25 #include <asm/syscalls.h>
 26 #include <asm/uaccess.h>
 27 #include <asm/unistd.h>
 28 #include <asm/cacheflush.h>
 29 #include <asm/cachectl.h>
 30 
 31 asmlinkage int old_mmap(unsigned long addr, unsigned long len,
 32         unsigned long prot, unsigned long flags,
 33         int fd, unsigned long off)
 34 {
 35         if (off & ~PAGE_MASK)
 36                 return -EINVAL;
 37         return sys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
 38 }
 39 
 40 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 41         unsigned long prot, unsigned long flags,
 42         unsigned long fd, unsigned long pgoff)
 43 {
 44         /*
 45          * The shift for mmap2 is constant, regardless of PAGE_SIZE
 46          * setting.
 47          */
 48         if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
 49                 return -EINVAL;
 50 
 51         pgoff >>= PAGE_SHIFT - 12;
 52 
 53         return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
 54 }
 55 
 56 /* sys_cacheflush -- flush (part of) the processor cache.  */
 57 asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
 58 {
 59         struct vm_area_struct *vma;
 60 
 61         if ((op <= 0) || (op > (CACHEFLUSH_D_PURGE|CACHEFLUSH_I)))
 62                 return -EINVAL;
 63 
 64         /*
 65          * Verify that the specified address region actually belongs
 66          * to this process.
 67          */
 68         if (addr + len < addr)
 69                 return -EFAULT;
 70 
 71         down_read(&current->mm->mmap_sem);
 72         vma = find_vma (current->mm, addr);
 73         if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) {
 74                 up_read(&current->mm->mmap_sem);
 75                 return -EFAULT;
 76         }
 77 
 78         switch (op & CACHEFLUSH_D_PURGE) {
 79                 case CACHEFLUSH_D_INVAL:
 80                         __flush_invalidate_region((void *)addr, len);
 81                         break;
 82                 case CACHEFLUSH_D_WB:
 83                         __flush_wback_region((void *)addr, len);
 84                         break;
 85                 case CACHEFLUSH_D_PURGE:
 86                         __flush_purge_region((void *)addr, len);
 87                         break;
 88         }
 89 
 90         if (op & CACHEFLUSH_I)
 91                 flush_icache_range(addr, addr+len);
 92 
 93         up_read(&current->mm->mmap_sem);
 94         return 0;
 95 }
 96 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp