xref: /openbmc/linux/arch/s390/kernel/compat_linux.h (revision 0a907292)
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 
9 /* Macro that masks the high order bit of an 32 bit pointer and converts it*/
10 /*       to a 64 bit pointer */
11 #define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
12 #define AA(__x)				\
13 	((unsigned long)(__x))
14 
15 /* Now 32bit compatibility types */
16 struct ipc_kludge_32 {
17         __u32   msgp;                           /* pointer              */
18         __s32   msgtyp;
19 };
20 
21 /* asm/sigcontext.h */
22 typedef union
23 {
24 	__u64   d;
25 	__u32   f;
26 } freg_t32;
27 
28 typedef struct
29 {
30 	unsigned int	fpc;
31 	unsigned int	pad;
32 	freg_t32	fprs[__NUM_FPRS];
33 } _s390_fp_regs32;
34 
35 typedef struct
36 {
37         __u32   mask;
38         __u32	addr;
39 } _psw_t32 __attribute__ ((aligned(8)));
40 
41 typedef struct
42 {
43 	_psw_t32	psw;
44 	__u32		gprs[__NUM_GPRS];
45 	__u32		acrs[__NUM_ACRS];
46 } _s390_regs_common32;
47 
48 typedef struct
49 {
50 	_s390_regs_common32 regs;
51 	_s390_fp_regs32     fpregs;
52 } _sigregs32;
53 
54 typedef struct
55 {
56 	__u32 gprs_high[__NUM_GPRS];
57 	__u64 vxrs_low[__NUM_VXRS_LOW];
58 	__vector128 vxrs_high[__NUM_VXRS_HIGH];
59 	__u8 __reserved[128];
60 } _sigregs_ext32;
61 
62 #define _SIGCONTEXT_NSIG32	64
63 #define _SIGCONTEXT_NSIG_BPW32	32
64 #define __SIGNAL_FRAMESIZE32	96
65 #define _SIGMASK_COPY_SIZE32	(sizeof(u32)*2)
66 
67 struct sigcontext32
68 {
69 	__u32	oldmask[_COMPAT_NSIG_WORDS];
70 	__u32	sregs;				/* pointer */
71 };
72 
73 /* asm/signal.h */
74 
75 /* asm/ucontext.h */
76 struct ucontext32 {
77 	__u32			uc_flags;
78 	__u32			uc_link;	/* pointer */
79 	compat_stack_t		uc_stack;
80 	_sigregs32		uc_mcontext;
81 	compat_sigset_t		uc_sigmask;
82 	/* Allow for uc_sigmask growth.  Glibc uses a 1024-bit sigset_t.  */
83 	unsigned char		__unused[128 - sizeof(compat_sigset_t)];
84 	_sigregs_ext32		uc_mcontext_ext;
85 };
86 
87 struct stat64_emu31;
88 struct mmap_arg_struct_emu31;
89 struct fadvise64_64_args;
90 
91 long compat_sys_s390_chown16(const char __user *filename, u16 user, u16 group);
92 long compat_sys_s390_lchown16(const char __user *filename, u16 user, u16 group);
93 long compat_sys_s390_fchown16(unsigned int fd, u16 user, u16 group);
94 long compat_sys_s390_setregid16(u16 rgid, u16 egid);
95 long compat_sys_s390_setgid16(u16 gid);
96 long compat_sys_s390_setreuid16(u16 ruid, u16 euid);
97 long compat_sys_s390_setuid16(u16 uid);
98 long compat_sys_s390_setresuid16(u16 ruid, u16 euid, u16 suid);
99 long compat_sys_s390_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid);
100 long compat_sys_s390_setresgid16(u16 rgid, u16 egid, u16 sgid);
101 long compat_sys_s390_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid);
102 long compat_sys_s390_setfsuid16(u16 uid);
103 long compat_sys_s390_setfsgid16(u16 gid);
104 long compat_sys_s390_getgroups16(int gidsetsize, u16 __user *grouplist);
105 long compat_sys_s390_setgroups16(int gidsetsize, u16 __user *grouplist);
106 long compat_sys_s390_getuid16(void);
107 long compat_sys_s390_geteuid16(void);
108 long compat_sys_s390_getgid16(void);
109 long compat_sys_s390_getegid16(void);
110 long compat_sys_s390_truncate64(const char __user *path, u32 high, u32 low);
111 long compat_sys_s390_ftruncate64(unsigned int fd, u32 high, u32 low);
112 long compat_sys_s390_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 high, u32 low);
113 long compat_sys_s390_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count, u32 high, u32 low);
114 long compat_sys_s390_readahead(int fd, u32 high, u32 low, s32 count);
115 long compat_sys_s390_stat64(const char __user *filename, struct stat64_emu31 __user *statbuf);
116 long compat_sys_s390_lstat64(const char __user *filename, struct stat64_emu31 __user *statbuf);
117 long compat_sys_s390_fstat64(unsigned int fd, struct stat64_emu31 __user *statbuf);
118 long compat_sys_s390_fstatat64(unsigned int dfd, const char __user *filename, struct stat64_emu31 __user *statbuf, int flag);
119 long compat_sys_s390_old_mmap(struct mmap_arg_struct_emu31 __user *arg);
120 long compat_sys_s390_mmap2(struct mmap_arg_struct_emu31 __user *arg);
121 long compat_sys_s390_read(unsigned int fd, char __user * buf, compat_size_t count);
122 long compat_sys_s390_write(unsigned int fd, const char __user * buf, compat_size_t count);
123 long compat_sys_s390_fadvise64(int fd, u32 high, u32 low, compat_size_t len, int advise);
124 long compat_sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
125 long compat_sys_s390_sync_file_range(int fd, u32 offhigh, u32 offlow, u32 nhigh, u32 nlow, unsigned int flags);
126 long compat_sys_s390_fallocate(int fd, int mode, u32 offhigh, u32 offlow, u32 lenhigh, u32 lenlow);
127 long compat_sys_sigreturn(void);
128 long compat_sys_rt_sigreturn(void);
129 
130 #endif /* _ASM_S390X_S390_H */
131