1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390X_S390_H
3 #define _ASM_S390X_S390_H
4 
5 #include <linux/compat.h>
6 #include <linux/socket.h>
7 #include <linux/syscalls.h>
8 #include <asm/ptrace.h>
9 
10 /*
11  * Macro that masks the high order bit of a 32 bit pointer and
12  * converts it to a 64 bit pointer.
13  */
14 #define A(__x)	((unsigned long)((__x) & 0x7FFFFFFFUL))
15 #define AA(__x)	((unsigned long)(__x))
16 
17 /* Now 32bit compatibility types */
18 struct ipc_kludge_32 {
19 	__u32	msgp;	/* pointer */
20 	__s32	msgtyp;
21 };
22 
23 /* asm/sigcontext.h */
24 typedef union {
25 	__u64	d;
26 	__u32	f;
27 } freg_t32;
28 
29 typedef struct {
30 	unsigned int	fpc;
31 	unsigned int	pad;
32 	freg_t32	fprs[__NUM_FPRS];
33 } _s390_fp_regs32;
34 
35 typedef struct {
36 	psw_t32		psw;
37 	__u32		gprs[__NUM_GPRS];
38 	__u32		acrs[__NUM_ACRS];
39 } _s390_regs_common32;
40 
41 typedef struct {
42 	_s390_regs_common32 regs;
43 	_s390_fp_regs32	    fpregs;
44 } _sigregs32;
45 
46 typedef struct {
47 	__u32		gprs_high[__NUM_GPRS];
48 	__u64		vxrs_low[__NUM_VXRS_LOW];
49 	__vector128	vxrs_high[__NUM_VXRS_HIGH];
50 	__u8		__reserved[128];
51 } _sigregs_ext32;
52 
53 #define _SIGCONTEXT_NSIG32	64
54 #define _SIGCONTEXT_NSIG_BPW32	32
55 #define __SIGNAL_FRAMESIZE32	96
56 #define _SIGMASK_COPY_SIZE32	(sizeof(u32) * 2)
57 
58 struct sigcontext32 {
59 	__u32	oldmask[_COMPAT_NSIG_WORDS];
60 	__u32	sregs;	/* pointer */
61 };
62 
63 /* asm/signal.h */
64 
65 /* asm/ucontext.h */
66 struct ucontext32 {
67 	__u32			uc_flags;
68 	__u32			uc_link;	/* pointer */
69 	compat_stack_t		uc_stack;
70 	_sigregs32		uc_mcontext;
71 	compat_sigset_t		uc_sigmask;
72 	/* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
73 	unsigned char		__unused[128 - sizeof(compat_sigset_t)];
74 	_sigregs_ext32		uc_mcontext_ext;
75 };
76 
77 struct stat64_emu31;
78 struct mmap_arg_struct_emu31;
79 struct fadvise64_64_args;
80 
81 long compat_sys_s390_truncate64(const char __user *path, u32 high, u32 low);
82 long compat_sys_s390_ftruncate64(unsigned int fd, u32 high, u32 low);
83 long compat_sys_s390_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 high, u32 low);
84 long compat_sys_s390_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count, u32 high, u32 low);
85 long compat_sys_s390_readahead(int fd, u32 high, u32 low, s32 count);
86 long compat_sys_s390_stat64(const char __user *filename, struct stat64_emu31 __user *statbuf);
87 long compat_sys_s390_lstat64(const char __user *filename, struct stat64_emu31 __user *statbuf);
88 long compat_sys_s390_fstat64(unsigned int fd, struct stat64_emu31 __user *statbuf);
89 long compat_sys_s390_fstatat64(unsigned int dfd, const char __user *filename, struct stat64_emu31 __user *statbuf, int flag);
90 long compat_sys_s390_old_mmap(struct mmap_arg_struct_emu31 __user *arg);
91 long compat_sys_s390_mmap2(struct mmap_arg_struct_emu31 __user *arg);
92 long compat_sys_s390_read(unsigned int fd, char __user *buf, compat_size_t count);
93 long compat_sys_s390_write(unsigned int fd, const char __user *buf, compat_size_t count);
94 long compat_sys_s390_fadvise64(int fd, u32 high, u32 low, compat_size_t len, int advise);
95 long compat_sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
96 long compat_sys_s390_sync_file_range(int fd, u32 offhigh, u32 offlow, u32 nhigh, u32 nlow, unsigned int flags);
97 long compat_sys_s390_fallocate(int fd, int mode, u32 offhigh, u32 offlow, u32 lenhigh, u32 lenlow);
98 long compat_sys_sigreturn(void);
99 long compat_sys_rt_sigreturn(void);
100 
101 #endif /* _ASM_S390X_S390_H */
102