Linux Audio

Check our new training course

Loading...
v6.2
  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
 14typedef u16		compat_mode_t;
 15
 16#define __compat_uid_t	__compat_uid_t
 17typedef u16		__compat_uid_t;
 18typedef u16		__compat_gid_t;
 19
 20#define compat_dev_t	compat_dev_t
 21typedef u16		compat_dev_t;
 22
 23#define compat_ipc_pid_t compat_ipc_pid_t
 24typedef 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 47typedef u16		compat_nlink_t;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 48
 49typedef struct {
 50	u32 mask;
 51	u32 addr;
 52} __aligned(8) psw_compat_t;
 53
 54typedef 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
 61typedef struct {
 62	u32 gprs_high[NUM_GPRS];
 63} s390_compat_regs_high;
 64
 
 
 
 
 
 
 
 
 
 
 65struct 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 88struct 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
103struct 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[4];
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
125static 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
133static 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 */
v4.17
  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
 12#define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p( \
 13				typeof(0?(__force t)0:0ULL), u64))
 14
 15#define __SC_DELOUSE(t,v) ({ \
 16	BUILD_BUG_ON(sizeof(t) > 4 && !__TYPE_IS_PTR(t)); \
 17	(__force t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \
 18})
 19
 20#define PSW32_MASK_PER		0x40000000UL
 21#define PSW32_MASK_DAT		0x04000000UL
 22#define PSW32_MASK_IO		0x02000000UL
 23#define PSW32_MASK_EXT		0x01000000UL
 24#define PSW32_MASK_KEY		0x00F00000UL
 25#define PSW32_MASK_BASE		0x00080000UL	/* Always one */
 26#define PSW32_MASK_MCHECK	0x00040000UL
 27#define PSW32_MASK_WAIT		0x00020000UL
 28#define PSW32_MASK_PSTATE	0x00010000UL
 29#define PSW32_MASK_ASC		0x0000C000UL
 30#define PSW32_MASK_CC		0x00003000UL
 31#define PSW32_MASK_PM		0x00000f00UL
 32#define PSW32_MASK_RI		0x00000080UL
 33
 34#define PSW32_MASK_USER		0x0000FF00UL
 35
 36#define PSW32_ADDR_AMODE	0x80000000UL
 37#define PSW32_ADDR_INSN		0x7FFFFFFFUL
 38
 39#define PSW32_DEFAULT_KEY	(((u32) PAGE_DEFAULT_ACC) << 20)
 40
 41#define PSW32_ASC_PRIMARY	0x00000000UL
 42#define PSW32_ASC_ACCREG	0x00004000UL
 43#define PSW32_ASC_SECONDARY	0x00008000UL
 44#define PSW32_ASC_HOME		0x0000C000UL
 45
 46#define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \
 47			 PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \
 48			 PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \
 49			 PSW32_ASC_PRIMARY)
 50
 51#define COMPAT_USER_HZ		100
 52#define COMPAT_UTS_MACHINE	"s390\0\0\0\0"
 53
 54typedef u32		compat_size_t;
 55typedef s32		compat_ssize_t;
 56typedef s32		compat_time_t;
 57typedef s32		compat_clock_t;
 58typedef s32		compat_pid_t;
 59typedef u16		__compat_uid_t;
 60typedef u16		__compat_gid_t;
 61typedef u32		__compat_uid32_t;
 62typedef u32		__compat_gid32_t;
 63typedef u16		compat_mode_t;
 64typedef u32		compat_ino_t;
 65typedef u16		compat_dev_t;
 66typedef s32		compat_off_t;
 67typedef s64		compat_loff_t;
 68typedef u16		compat_nlink_t;
 69typedef u16		compat_ipc_pid_t;
 70typedef s32		compat_daddr_t;
 71typedef u32		compat_caddr_t;
 72typedef __kernel_fsid_t	compat_fsid_t;
 73typedef s32		compat_key_t;
 74typedef s32		compat_timer_t;
 75
 76typedef s32		compat_int_t;
 77typedef s32		compat_long_t;
 78typedef s64		compat_s64;
 79typedef u32		compat_uint_t;
 80typedef u32		compat_ulong_t;
 81typedef u64		compat_u64;
 82typedef u32		compat_uptr_t;
 83
 84typedef struct {
 85	u32 mask;
 86	u32 addr;
 87} __aligned(8) psw_compat_t;
 88
 89typedef struct {
 90	psw_compat_t psw;
 91	u32 gprs[NUM_GPRS];
 92	u32 acrs[NUM_ACRS];
 93	u32 orig_gpr2;
 94} s390_compat_regs;
 95
 96typedef struct {
 97	u32 gprs_high[NUM_GPRS];
 98} s390_compat_regs_high;
 99
100struct compat_timespec {
101	compat_time_t	tv_sec;
102	s32		tv_nsec;
103};
104
105struct compat_timeval {
106	compat_time_t	tv_sec;
107	s32		tv_usec;
108};
109
110struct compat_stat {
111	compat_dev_t	st_dev;
112	u16		__pad1;
113	compat_ino_t	st_ino;
114	compat_mode_t	st_mode;
115	compat_nlink_t	st_nlink;
116	__compat_uid_t	st_uid;
117	__compat_gid_t	st_gid;
118	compat_dev_t	st_rdev;
119	u16		__pad2;
120	u32		st_size;
121	u32		st_blksize;
122	u32		st_blocks;
123	u32		st_atime;
124	u32		st_atime_nsec;
125	u32		st_mtime;
126	u32		st_mtime_nsec;
127	u32		st_ctime;
128	u32		st_ctime_nsec;
129	u32		__unused4;
130	u32		__unused5;
131};
132
133struct compat_flock {
134	short		l_type;
135	short		l_whence;
136	compat_off_t	l_start;
137	compat_off_t	l_len;
138	compat_pid_t	l_pid;
139};
140
141#define F_GETLK64       12
142#define F_SETLK64       13
143#define F_SETLKW64      14    
144
145struct compat_flock64 {
146	short		l_type;
147	short		l_whence;
148	compat_loff_t	l_start;
149	compat_loff_t	l_len;
150	compat_pid_t	l_pid;
151};
152
153struct compat_statfs {
154	u32		f_type;
155	u32		f_bsize;
156	u32		f_blocks;
157	u32		f_bfree;
158	u32		f_bavail;
159	u32		f_files;
160	u32		f_ffree;
161	compat_fsid_t	f_fsid;
162	u32		f_namelen;
163	u32		f_frsize;
164	u32		f_flags;
165	u32		f_spare[4];
166};
167
168struct compat_statfs64 {
169	u32		f_type;
170	u32		f_bsize;
171	u64		f_blocks;
172	u64		f_bfree;
173	u64		f_bavail;
174	u64		f_files;
175	u64		f_ffree;
176	compat_fsid_t	f_fsid;
177	u32		f_namelen;
178	u32		f_frsize;
179	u32		f_flags;
180	u32		f_spare[4];
181};
182
183#define COMPAT_RLIM_INFINITY		0xffffffff
184
185typedef u32		compat_old_sigset_t;	/* at least 32 bits */
186
187#define _COMPAT_NSIG		64
188#define _COMPAT_NSIG_BPW	32
189
190typedef u32		compat_sigset_word;
191
192#define COMPAT_OFF_T_MAX	0x7fffffff
193
194/*
195 * A pointer passed in from user mode. This should not
196 * be used for syscall parameters, just declare them
197 * as pointers because the syscall entry code will have
198 * appropriately converted them already.
199 */
200
201static inline void __user *compat_ptr(compat_uptr_t uptr)
202{
203	return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
204}
205
206static inline compat_uptr_t ptr_to_compat(void __user *uptr)
207{
208	return (u32)(unsigned long)uptr;
209}
210
211#ifdef CONFIG_COMPAT
212
213static inline int is_compat_task(void)
214{
215	return test_thread_flag(TIF_31BIT);
216}
217
218static inline void __user *arch_compat_alloc_user_space(long len)
219{
220	unsigned long stack;
221
222	stack = KSTK_ESP(current);
223	if (is_compat_task())
224		stack &= 0x7fffffffUL;
225	return (void __user *) (stack - len);
226}
227
228#endif
229
230struct compat_ipc64_perm {
231	compat_key_t key;
232	__compat_uid32_t uid;
233	__compat_gid32_t gid;
234	__compat_uid32_t cuid;
235	__compat_gid32_t cgid;
236	compat_mode_t mode;
237	unsigned short __pad1;
238	unsigned short seq;
239	unsigned short __pad2;
240	unsigned int __unused1;
241	unsigned int __unused2;
242};
243
244struct compat_semid64_ds {
245	struct compat_ipc64_perm sem_perm;
246	compat_time_t  sem_otime;
247	compat_ulong_t __pad1;
248	compat_time_t  sem_ctime;
249	compat_ulong_t __pad2;
250	compat_ulong_t sem_nsems;
251	compat_ulong_t __unused1;
252	compat_ulong_t __unused2;
253};
254
255struct compat_msqid64_ds {
256	struct compat_ipc64_perm msg_perm;
257	compat_time_t   msg_stime;
258	compat_ulong_t __pad1;
259	compat_time_t   msg_rtime;
260	compat_ulong_t __pad2;
261	compat_time_t   msg_ctime;
262	compat_ulong_t __pad3;
263	compat_ulong_t msg_cbytes;
264	compat_ulong_t msg_qnum;
265	compat_ulong_t msg_qbytes;
266	compat_pid_t   msg_lspid;
267	compat_pid_t   msg_lrpid;
268	compat_ulong_t __unused1;
269	compat_ulong_t __unused2;
270};
271
272struct compat_shmid64_ds {
273	struct compat_ipc64_perm shm_perm;
274	compat_size_t  shm_segsz;
275	compat_time_t  shm_atime;
276	compat_ulong_t __pad1;
277	compat_time_t  shm_dtime;
278	compat_ulong_t __pad2;
279	compat_time_t  shm_ctime;
280	compat_ulong_t __pad3;
281	compat_pid_t   shm_cpid;
282	compat_pid_t   shm_lpid;
283	compat_ulong_t shm_nattch;
284	compat_ulong_t __unused1;
285	compat_ulong_t __unused2;
286};
287#endif /* _ASM_S390X_COMPAT_H */