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

TOMOYO Linux Cross Reference
Linux/arch/xtensa/kernel/syscall.c

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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  * arch/xtensa/kernel/syscall.c
  3  *
  4  * This file is subject to the terms and conditions of the GNU General Public
  5  * License.  See the file "COPYING" in the main directory of this archive
  6  * for more details.
  7  *
  8  * Copyright (C) 2001 - 2005 Tensilica Inc.
  9  * Copyright (C) 2000 Silicon Graphics, Inc.
 10  * Copyright (C) 1995 - 2000 by Ralf Baechle
 11  *
 12  * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
 13  * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca>
 14  * Chris Zankel <chris@zankel.net>
 15  * Kevin Chea
 16  *
 17  */
 18 #include <asm/uaccess.h>
 19 #include <asm/syscall.h>
 20 #include <asm/unistd.h>
 21 #include <linux/linkage.h>
 22 #include <linux/stringify.h>
 23 #include <linux/errno.h>
 24 #include <linux/syscalls.h>
 25 #include <linux/file.h>
 26 #include <linux/fs.h>
 27 #include <linux/mman.h>
 28 #include <linux/shm.h>
 29 
 30 typedef void (*syscall_t)(void);
 31 
 32 syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
 33         [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall,
 34 
 35 #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,
 36 #include <uapi/asm/unistd.h>
 37 };
 38 
 39 #define COLOUR_ALIGN(addr, pgoff) \
 40         ((((addr) + SHMLBA - 1) & ~(SHMLBA - 1)) + \
 41          (((pgoff) << PAGE_SHIFT) & (SHMLBA - 1)))
 42 
 43 asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
 44 {
 45         unsigned long ret;
 46         long err;
 47 
 48         err = do_shmat(shmid, shmaddr, shmflg, &ret, SHMLBA);
 49         if (err)
 50                 return err;
 51         return (long)ret;
 52 }
 53 
 54 asmlinkage long xtensa_fadvise64_64(int fd, int advice,
 55                 unsigned long long offset, unsigned long long len)
 56 {
 57         return sys_fadvise64_64(fd, offset, len, advice);
 58 }
 59 
 60 unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
 61                 unsigned long len, unsigned long pgoff, unsigned long flags)
 62 {
 63         struct vm_area_struct *vmm;
 64 
 65         if (flags & MAP_FIXED) {
 66                 /* We do not accept a shared mapping if it would violate
 67                  * cache aliasing constraints.
 68                  */
 69                 if ((flags & MAP_SHARED) &&
 70                                 ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
 71                         return -EINVAL;
 72                 return addr;
 73         }
 74 
 75         if (len > TASK_SIZE)
 76                 return -ENOMEM;
 77         if (!addr)
 78                 addr = TASK_UNMAPPED_BASE;
 79 
 80         if (flags & MAP_SHARED)
 81                 addr = COLOUR_ALIGN(addr, pgoff);
 82         else
 83                 addr = PAGE_ALIGN(addr);
 84 
 85         for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
 86                 /* At this point:  (!vmm || addr < vmm->vm_end). */
 87                 if (TASK_SIZE - len < addr)
 88                         return -ENOMEM;
 89                 if (!vmm || addr + len <= vm_start_gap(vmm))
 90                         return addr;
 91                 addr = vmm->vm_end;
 92                 if (flags & MAP_SHARED)
 93                         addr = COLOUR_ALIGN(addr, pgoff);
 94         }
 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