xref: /openbmc/linux/arch/s390/kernel/compat_linux.h (revision e23feb16)
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 /* asm/sigcontext.h */
21 typedef union
22 {
23 	__u64   d;
24 	__u32   f;
25 } freg_t32;
26 
27 typedef struct
28 {
29 	unsigned int	fpc;
30 	freg_t32	fprs[__NUM_FPRS];
31 } _s390_fp_regs32;
32 
33 typedef struct
34 {
35         __u32   mask;
36         __u32	addr;
37 } _psw_t32 __attribute__ ((aligned(8)));
38 
39 typedef struct
40 {
41 	_psw_t32	psw;
42 	__u32		gprs[__NUM_GPRS];
43 	__u32		acrs[__NUM_ACRS];
44 } _s390_regs_common32;
45 
46 typedef struct
47 {
48 	_s390_regs_common32 regs;
49 	_s390_fp_regs32     fpregs;
50 } _sigregs32;
51 
52 #define _SIGCONTEXT_NSIG32	64
53 #define _SIGCONTEXT_NSIG_BPW32	32
54 #define __SIGNAL_FRAMESIZE32	96
55 #define _SIGMASK_COPY_SIZE32	(sizeof(u32)*2)
56 
57 struct sigcontext32
58 {
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;	/* mask last for extensibility */
72 };
73 
74 struct stat64_emu31;
75 struct mmap_arg_struct_emu31;
76 struct fadvise64_64_args;
77 
78 long sys32_chown16(const char __user * filename, u16 user, u16 group);
79 long sys32_lchown16(const char __user * filename, u16 user, u16 group);
80 long sys32_fchown16(unsigned int fd, u16 user, u16 group);
81 long sys32_setregid16(u16 rgid, u16 egid);
82 long sys32_setgid16(u16 gid);
83 long sys32_setreuid16(u16 ruid, u16 euid);
84 long sys32_setuid16(u16 uid);
85 long sys32_setresuid16(u16 ruid, u16 euid, u16 suid);
86 long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid);
87 long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid);
88 long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid);
89 long sys32_setfsuid16(u16 uid);
90 long sys32_setfsgid16(u16 gid);
91 long sys32_getgroups16(int gidsetsize, u16 __user *grouplist);
92 long sys32_setgroups16(int gidsetsize, u16 __user *grouplist);
93 long sys32_getuid16(void);
94 long sys32_geteuid16(void);
95 long sys32_getgid16(void);
96 long sys32_getegid16(void);
97 long sys32_truncate64(const char __user * path, unsigned long high,
98 		      unsigned long low);
99 long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
100 long sys32_init_module(void __user *umod, unsigned long len,
101 		       const char __user *uargs);
102 long sys32_delete_module(const char __user *name_user, unsigned int flags);
103 long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
104 		   u32 poshi, u32 poslo);
105 long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
106 		    size_t count, u32 poshi, u32 poslo);
107 compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count);
108 long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
109 long sys32_lstat64(const char __user * filename,
110 		   struct stat64_emu31 __user * statbuf);
111 long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf);
112 long sys32_fstatat64(unsigned int dfd, const char __user *filename,
113 		     struct stat64_emu31 __user* statbuf, int flag);
114 unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg);
115 long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg);
116 long sys32_read(unsigned int fd, char __user * buf, size_t count);
117 long sys32_write(unsigned int fd, const char __user * buf, size_t count);
118 long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
119 long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
120 #endif /* _ASM_S390X_S390_H */
121