xref: /openbmc/linux/arch/s390/kernel/compat_linux.h (revision 9d749629)
1 #ifndef _ASM_S390X_S390_H
2 #define _ASM_S390X_S390_H
3 
4 #include <linux/compat.h>
5 #include <linux/socket.h>
6 #include <linux/syscalls.h>
7 
8 /* Macro that masks the high order bit of an 32 bit pointer and converts it*/
9 /*       to a 64 bit pointer */
10 #define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
11 #define AA(__x)				\
12 	((unsigned long)(__x))
13 
14 /* Now 32bit compatibility types */
15 struct ipc_kludge_32 {
16         __u32   msgp;                           /* pointer              */
17         __s32   msgtyp;
18 };
19 
20 struct old_sigaction32 {
21        __u32			sa_handler;	/* Really a pointer, but need to deal with 32 bits */
22        compat_old_sigset_t	sa_mask;	/* A 32 bit mask */
23        __u32			sa_flags;
24        __u32			sa_restorer;	/* Another 32 bit pointer */
25 };
26 
27 /* asm/sigcontext.h */
28 typedef union
29 {
30 	__u64   d;
31 	__u32   f;
32 } freg_t32;
33 
34 typedef struct
35 {
36 	unsigned int	fpc;
37 	freg_t32	fprs[__NUM_FPRS];
38 } _s390_fp_regs32;
39 
40 typedef struct
41 {
42         __u32   mask;
43         __u32	addr;
44 } _psw_t32 __attribute__ ((aligned(8)));
45 
46 typedef struct
47 {
48 	_psw_t32	psw;
49 	__u32		gprs[__NUM_GPRS];
50 	__u32		acrs[__NUM_ACRS];
51 } _s390_regs_common32;
52 
53 typedef struct
54 {
55 	_s390_regs_common32 regs;
56 	_s390_fp_regs32     fpregs;
57 } _sigregs32;
58 
59 #define _SIGCONTEXT_NSIG32	64
60 #define _SIGCONTEXT_NSIG_BPW32	32
61 #define __SIGNAL_FRAMESIZE32	96
62 #define _SIGMASK_COPY_SIZE32	(sizeof(u32)*2)
63 
64 struct sigcontext32
65 {
66 	__u32	oldmask[_COMPAT_NSIG_WORDS];
67 	__u32	sregs;				/* pointer */
68 };
69 
70 /* asm/signal.h */
71 struct sigaction32 {
72 	__u32		sa_handler;		/* pointer */
73 	__u32		sa_flags;
74         __u32		sa_restorer;		/* pointer */
75 	compat_sigset_t	sa_mask;        /* mask last for extensibility */
76 };
77 
78 typedef struct {
79 	__u32			ss_sp;		/* pointer */
80 	int			ss_flags;
81 	compat_size_t		ss_size;
82 } stack_t32;
83 
84 /* asm/ucontext.h */
85 struct ucontext32 {
86 	__u32			uc_flags;
87 	__u32			uc_link;	/* pointer */
88 	stack_t32		uc_stack;
89 	_sigregs32		uc_mcontext;
90 	compat_sigset_t		uc_sigmask;	/* mask last for extensibility */
91 };
92 
93 struct stat64_emu31;
94 struct mmap_arg_struct_emu31;
95 struct fadvise64_64_args;
96 struct old_sigaction32;
97 struct old_sigaction32;
98 
99 long sys32_chown16(const char __user * filename, u16 user, u16 group);
100 long sys32_lchown16(const char __user * filename, u16 user, u16 group);
101 long sys32_fchown16(unsigned int fd, u16 user, u16 group);
102 long sys32_setregid16(u16 rgid, u16 egid);
103 long sys32_setgid16(u16 gid);
104 long sys32_setreuid16(u16 ruid, u16 euid);
105 long sys32_setuid16(u16 uid);
106 long sys32_setresuid16(u16 ruid, u16 euid, u16 suid);
107 long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid);
108 long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid);
109 long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid);
110 long sys32_setfsuid16(u16 uid);
111 long sys32_setfsgid16(u16 gid);
112 long sys32_getgroups16(int gidsetsize, u16 __user *grouplist);
113 long sys32_setgroups16(int gidsetsize, u16 __user *grouplist);
114 long sys32_getuid16(void);
115 long sys32_geteuid16(void);
116 long sys32_getgid16(void);
117 long sys32_getegid16(void);
118 long sys32_ipc(u32 call, int first, int second, int third, u32 ptr);
119 long sys32_truncate64(const char __user * path, unsigned long high,
120 		      unsigned long low);
121 long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
122 long sys32_sched_rr_get_interval(compat_pid_t pid,
123 				 struct compat_timespec __user *interval);
124 long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
125 			  compat_sigset_t __user *oset, size_t sigsetsize);
126 long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
127 long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
128 long sys32_init_module(void __user *umod, unsigned long len,
129 		       const char __user *uargs);
130 long sys32_delete_module(const char __user *name_user, unsigned int flags);
131 long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
132 		   u32 poshi, u32 poslo);
133 long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
134 		    size_t count, u32 poshi, u32 poslo);
135 compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count);
136 long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
137 		    size_t count);
138 long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
139 		      s32 count);
140 long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
141 long sys32_lstat64(const char __user * filename,
142 		   struct stat64_emu31 __user * statbuf);
143 long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf);
144 long sys32_fstatat64(unsigned int dfd, const char __user *filename,
145 		     struct stat64_emu31 __user* statbuf, int flag);
146 unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg);
147 long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg);
148 long sys32_read(unsigned int fd, char __user * buf, size_t count);
149 long sys32_write(unsigned int fd, const char __user * buf, size_t count);
150 long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
151 long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
152 long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
153 		     struct old_sigaction32 __user *oact);
154 long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
155 			struct sigaction32 __user *oact, size_t sigsetsize);
156 long sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss);
157 #endif /* _ASM_S390X_S390_H */
158