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

TOMOYO Linux Cross Reference
Linux/arch/s390/include/asm/syscall.h

Version: ~ [ linux-5.1-rc5 ] ~ [ linux-5.0.7 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.34 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.111 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.168 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.178 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.138 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.65 ] ~ [ 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.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ 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 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Access to user system call parameters and results
  4  *
  5  *  Copyright IBM Corp. 2008
  6  *  Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
  7  */
  8 
  9 #ifndef _ASM_SYSCALL_H
 10 #define _ASM_SYSCALL_H  1
 11 
 12 #include <uapi/linux/audit.h>
 13 #include <linux/sched.h>
 14 #include <linux/err.h>
 15 #include <asm/ptrace.h>
 16 
 17 /*
 18  * The syscall table always contains 32 bit pointers since we know that the
 19  * address of the function to be called is (way) below 4GB.  So the "int"
 20  * type here is what we want [need] for both 32 bit and 64 bit systems.
 21  */
 22 extern const unsigned int sys_call_table[];
 23 extern const unsigned int sys_call_table_emu[];
 24 
 25 static inline long syscall_get_nr(struct task_struct *task,
 26                                   struct pt_regs *regs)
 27 {
 28         return test_pt_regs_flag(regs, PIF_SYSCALL) ?
 29                 (regs->int_code & 0xffff) : -1;
 30 }
 31 
 32 static inline void syscall_rollback(struct task_struct *task,
 33                                     struct pt_regs *regs)
 34 {
 35         regs->gprs[2] = regs->orig_gpr2;
 36 }
 37 
 38 static inline long syscall_get_error(struct task_struct *task,
 39                                      struct pt_regs *regs)
 40 {
 41         return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0;
 42 }
 43 
 44 static inline long syscall_get_return_value(struct task_struct *task,
 45                                             struct pt_regs *regs)
 46 {
 47         return regs->gprs[2];
 48 }
 49 
 50 static inline void syscall_set_return_value(struct task_struct *task,
 51                                             struct pt_regs *regs,
 52                                             int error, long val)
 53 {
 54         regs->gprs[2] = error ? error : val;
 55 }
 56 
 57 static inline void syscall_get_arguments(struct task_struct *task,
 58                                          struct pt_regs *regs,
 59                                          unsigned long *args)
 60 {
 61         unsigned long mask = -1UL;
 62         unsigned int n = 6;
 63 
 64 #ifdef CONFIG_COMPAT
 65         if (test_tsk_thread_flag(task, TIF_31BIT))
 66                 mask = 0xffffffff;
 67 #endif
 68         while (n-- > 0)
 69                 if (n > 0)
 70                         args[n] = regs->gprs[2 + n] & mask;
 71 
 72         args[0] = regs->orig_gpr2 & mask;
 73 }
 74 
 75 static inline void syscall_set_arguments(struct task_struct *task,
 76                                          struct pt_regs *regs,
 77                                          const unsigned long *args)
 78 {
 79         unsigned int n = 6;
 80 
 81         while (n-- > 0)
 82                 if (n > 0)
 83                         regs->gprs[2 + n] = args[n];
 84         regs->orig_gpr2 = args[0];
 85 }
 86 
 87 static inline int syscall_get_arch(void)
 88 {
 89 #ifdef CONFIG_COMPAT
 90         if (test_tsk_thread_flag(current, TIF_31BIT))
 91                 return AUDIT_ARCH_S390;
 92 #endif
 93         return AUDIT_ARCH_S390X;
 94 }
 95 #endif  /* _ASM_SYSCALL_H */
 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