Linux Audio

Check our new training course

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