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

TOMOYO Linux Cross Reference
Linux/arch/s390/kernel/sys_s390.c

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ 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.72 ] ~ [ 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-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ 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  *  S390 version
  3  *    Copyright IBM Corp. 1999, 2000
  4  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  5  *               Thomas Spatzier (tspat@de.ibm.com)
  6  *
  7  *  Derived from "arch/i386/kernel/sys_i386.c"
  8  *
  9  *  This file contains various random system calls that
 10  *  have a non-standard calling sequence on the Linux/s390
 11  *  platform.
 12  */
 13 
 14 #include <linux/errno.h>
 15 #include <linux/sched.h>
 16 #include <linux/mm.h>
 17 #include <linux/fs.h>
 18 #include <linux/smp.h>
 19 #include <linux/sem.h>
 20 #include <linux/msg.h>
 21 #include <linux/shm.h>
 22 #include <linux/stat.h>
 23 #include <linux/syscalls.h>
 24 #include <linux/mman.h>
 25 #include <linux/file.h>
 26 #include <linux/utsname.h>
 27 #include <linux/personality.h>
 28 #include <linux/unistd.h>
 29 #include <linux/ipc.h>
 30 #include <asm/uaccess.h>
 31 #include "entry.h"
 32 
 33 /*
 34  * Perform the mmap() system call. Linux for S/390 isn't able to handle more
 35  * than 5 system call parameters, so this system call uses a memory block
 36  * for parameter passing.
 37  */
 38 
 39 struct s390_mmap_arg_struct {
 40         unsigned long addr;
 41         unsigned long len;
 42         unsigned long prot;
 43         unsigned long flags;
 44         unsigned long fd;
 45         unsigned long offset;
 46 };
 47 
 48 SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
 49 {
 50         struct s390_mmap_arg_struct a;
 51         int error = -EFAULT;
 52 
 53         if (copy_from_user(&a, arg, sizeof(a)))
 54                 goto out;
 55         error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
 56 out:
 57         return error;
 58 }
 59 
 60 /*
 61  * sys_ipc() is the de-multiplexer for the SysV IPC calls.
 62  */
 63 SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
 64                 unsigned long, third, void __user *, ptr)
 65 {
 66         if (call >> 16)
 67                 return -EINVAL;
 68         /* The s390 sys_ipc variant has only five parameters instead of six
 69          * like the generic variant. The only difference is the handling of
 70          * the SEMTIMEDOP subcall where on s390 the third parameter is used
 71          * as a pointer to a struct timespec where the generic variant uses
 72          * the fifth parameter.
 73          * Therefore we can call the generic variant by simply passing the
 74          * third parameter also as fifth parameter.
 75          */
 76         return sys_ipc(call, first, second, third, ptr, third);
 77 }
 78 
 79 #ifdef CONFIG_64BIT
 80 SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
 81 {
 82         unsigned int ret;
 83 
 84         if (personality(current->personality) == PER_LINUX32 &&
 85             personality(personality) == PER_LINUX)
 86                 personality |= PER_LINUX32;
 87         ret = sys_personality(personality);
 88         if (personality(ret) == PER_LINUX32)
 89                 ret &= ~PER_LINUX32;
 90 
 91         return ret;
 92 }
 93 #endif /* CONFIG_64BIT */
 94 
 95 /*
 96  * Wrapper function for sys_fadvise64/fadvise64_64
 97  */
 98 #ifndef CONFIG_64BIT
 99 
100 SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
101                 size_t, len, int, advice)
102 {
103         return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
104                         len, advice);
105 }
106 
107 struct fadvise64_64_args {
108         int fd;
109         long long offset;
110         long long len;
111         int advice;
112 };
113 
114 SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
115 {
116         struct fadvise64_64_args a;
117 
118         if ( copy_from_user(&a, args, sizeof(a)) )
119                 return -EFAULT;
120         return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
121 }
122 
123 /*
124  * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
125  * 64 bit argument "len" is split into the upper and lower 32 bits. The
126  * system call wrapper in the user space loads the value to %r6/%r7.
127  * The code in entry.S keeps the values in %r2 - %r6 where they are and
128  * stores %r7 to 96(%r15). But the standard C linkage requires that
129  * the whole 64 bit value for len is stored on the stack and doesn't
130  * use %r6 at all. So s390_fallocate has to convert the arguments from
131  *   %r2: fd, %r3: mode, %r4/%r5: offset, %r6/96(%r15)-99(%r15): len
132  * to
133  *   %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
134  */
135 SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
136                                u32 len_high, u32 len_low)
137 {
138         return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
139 }
140 #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
141 asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
142                                    long len_high, long len_low)
143 {
144         return SYSC_s390_fallocate((int) fd, (int) mode, offset,
145                                    (u32) len_high, (u32) len_low);
146 }
147 SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
148 #endif
149 
150 #endif
151 

~ [ 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