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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _ASM_S390X_COMPAT_H
  3 #define _ASM_S390X_COMPAT_H
  4 /*
  5  * Architecture specific compatibility types
  6  */
  7 #include <linux/types.h>
  8 #include <linux/sched.h>
  9 #include <linux/sched/task_stack.h>
 10 #include <linux/thread_info.h>
 11 #include <asm/ptrace.h>
 12 
 13 #define compat_mode_t   compat_mode_t
 14 typedef u16             compat_mode_t;
 15 
 16 #define __compat_uid_t  __compat_uid_t
 17 typedef u16             __compat_uid_t;
 18 typedef u16             __compat_gid_t;
 19 
 20 #define compat_dev_t    compat_dev_t
 21 typedef u16             compat_dev_t;
 22 
 23 #define compat_ipc_pid_t compat_ipc_pid_t
 24 typedef u16              compat_ipc_pid_t;
 25 
 26 #define compat_statfs   compat_statfs
 27 
 28 #include <asm-generic/compat.h>
 29 
 30 #define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p( \
 31                                 typeof(0?(__force t)0:0ULL), u64))
 32 
 33 #define __SC_DELOUSE(t,v) ({ \
 34         BUILD_BUG_ON(sizeof(t) > 4 && !__TYPE_IS_PTR(t)); \
 35         (__force t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \
 36 })
 37 
 38 #define PSW32_MASK_USER         0x0000FF00UL
 39 
 40 #define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \
 41                          PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \
 42                          PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \
 43                          PSW32_ASC_PRIMARY)
 44 
 45 #define COMPAT_UTS_MACHINE      "s390\0\0\0\0"
 46 
 47 typedef u16             compat_nlink_t;
 48 
 49 typedef struct {
 50         u32 mask;
 51         u32 addr;
 52 } __aligned(8) psw_compat_t;
 53 
 54 typedef struct {
 55         psw_compat_t psw;
 56         u32 gprs[NUM_GPRS];
 57         u32 acrs[NUM_ACRS];
 58         u32 orig_gpr2;
 59 } s390_compat_regs;
 60 
 61 typedef struct {
 62         u32 gprs_high[NUM_GPRS];
 63 } s390_compat_regs_high;
 64 
 65 struct compat_stat {
 66         compat_dev_t    st_dev;
 67         u16             __pad1;
 68         compat_ino_t    st_ino;
 69         compat_mode_t   st_mode;
 70         compat_nlink_t  st_nlink;
 71         __compat_uid_t  st_uid;
 72         __compat_gid_t  st_gid;
 73         compat_dev_t    st_rdev;
 74         u16             __pad2;
 75         u32             st_size;
 76         u32             st_blksize;
 77         u32             st_blocks;
 78         u32             st_atime;
 79         u32             st_atime_nsec;
 80         u32             st_mtime;
 81         u32             st_mtime_nsec;
 82         u32             st_ctime;
 83         u32             st_ctime_nsec;
 84         u32             __unused4;
 85         u32             __unused5;
 86 };
 87 
 88 struct compat_statfs {
 89         u32             f_type;
 90         u32             f_bsize;
 91         u32             f_blocks;
 92         u32             f_bfree;
 93         u32             f_bavail;
 94         u32             f_files;
 95         u32             f_ffree;
 96         compat_fsid_t   f_fsid;
 97         u32             f_namelen;
 98         u32             f_frsize;
 99         u32             f_flags;
100         u32             f_spare[4];
101 };
102 
103 struct compat_statfs64 {
104         u32             f_type;
105         u32             f_bsize;
106         u64             f_blocks;
107         u64             f_bfree;
108         u64             f_bavail;
109         u64             f_files;
110         u64             f_ffree;
111         compat_fsid_t   f_fsid;
112         u32             f_namelen;
113         u32             f_frsize;
114         u32             f_flags;
115         u32             f_spare[5];
116 };
117 
118 /*
119  * A pointer passed in from user mode. This should not
120  * be used for syscall parameters, just declare them
121  * as pointers because the syscall entry code will have
122  * appropriately converted them already.
123  */
124 
125 static inline void __user *compat_ptr(compat_uptr_t uptr)
126 {
127         return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
128 }
129 #define compat_ptr(uptr) compat_ptr(uptr)
130 
131 #ifdef CONFIG_COMPAT
132 
133 static inline int is_compat_task(void)
134 {
135         return test_thread_flag(TIF_31BIT);
136 }
137 
138 #endif
139 
140 #endif /* _ASM_S390X_COMPAT_H */
141 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php