aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/compat_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/compat_linux.h')
-rw-r--r--arch/s390/kernel/compat_linux.h197
1 files changed, 197 insertions, 0 deletions
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
new file mode 100644
index 000000000000..bf33dcfec7db
--- /dev/null
+++ b/arch/s390/kernel/compat_linux.h
@@ -0,0 +1,197 @@
1#ifndef _ASM_S390X_S390_H
2#define _ASM_S390X_S390_H
3
4#include <linux/config.h>
5#include <linux/compat.h>
6#include <linux/socket.h>
7#include <linux/syscalls.h>
8#include <linux/nfs_fs.h>
9#include <linux/sunrpc/svc.h>
10#include <linux/nfsd/nfsd.h>
11#include <linux/nfsd/export.h>
12
13/* Macro that masks the high order bit of an 32 bit pointer and converts it*/
14/* to a 64 bit pointer */
15#define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
16#define AA(__x) \
17 ((unsigned long)(__x))
18
19/* Now 32bit compatibility types */
20struct ipc_kludge_32 {
21 __u32 msgp; /* pointer */
22 __s32 msgtyp;
23};
24
25struct old_sigaction32 {
26 __u32 sa_handler; /* Really a pointer, but need to deal with 32 bits */
27 compat_old_sigset_t sa_mask; /* A 32 bit mask */
28 __u32 sa_flags;
29 __u32 sa_restorer; /* Another 32 bit pointer */
30};
31
32typedef struct compat_siginfo {
33 int si_signo;
34 int si_errno;
35 int si_code;
36
37 union {
38 int _pad[((128/sizeof(int)) - 3)];
39
40 /* kill() */
41 struct {
42 pid_t _pid; /* sender's pid */
43 uid_t _uid; /* sender's uid */
44 } _kill;
45
46 /* POSIX.1b timers */
47 struct {
48 timer_t _tid; /* timer id */
49 int _overrun; /* overrun count */
50 compat_sigval_t _sigval; /* same as below */
51 int _sys_private; /* not to be passed to user */
52 } _timer;
53
54 /* POSIX.1b signals */
55 struct {
56 pid_t _pid; /* sender's pid */
57 uid_t _uid; /* sender's uid */
58 compat_sigval_t _sigval;
59 } _rt;
60
61 /* SIGCHLD */
62 struct {
63 pid_t _pid; /* which child */
64 uid_t _uid; /* sender's uid */
65 int _status;/* exit code */
66 compat_clock_t _utime;
67 compat_clock_t _stime;
68 } _sigchld;
69
70 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
71 struct {
72 __u32 _addr; /* faulting insn/memory ref. - pointer */
73 } _sigfault;
74
75 /* SIGPOLL */
76 struct {
77 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
78 int _fd;
79 } _sigpoll;
80 } _sifields;
81} compat_siginfo_t;
82
83/*
84 * How these fields are to be accessed.
85 */
86#define si_pid _sifields._kill._pid
87#define si_uid _sifields._kill._uid
88#define si_status _sifields._sigchld._status
89#define si_utime _sifields._sigchld._utime
90#define si_stime _sifields._sigchld._stime
91#define si_value _sifields._rt._sigval
92#define si_int _sifields._rt._sigval.sival_int
93#define si_ptr _sifields._rt._sigval.sival_ptr
94#define si_addr _sifields._sigfault._addr
95#define si_band _sifields._sigpoll._band
96#define si_fd _sifields._sigpoll._fd
97#define si_tid _sifields._timer._tid
98#define si_overrun _sifields._timer._overrun
99
100/* asm/sigcontext.h */
101typedef union
102{
103 __u64 d;
104 __u32 f;
105} freg_t32;
106
107typedef struct
108{
109 unsigned int fpc;
110 freg_t32 fprs[__NUM_FPRS];
111} _s390_fp_regs32;
112
113typedef struct
114{
115 __u32 mask;
116 __u32 addr;
117} _psw_t32 __attribute__ ((aligned(8)));
118
119#define PSW32_MASK_PER 0x40000000UL
120#define PSW32_MASK_DAT 0x04000000UL
121#define PSW32_MASK_IO 0x02000000UL
122#define PSW32_MASK_EXT 0x01000000UL
123#define PSW32_MASK_KEY 0x00F00000UL
124#define PSW32_MASK_MCHECK 0x00040000UL
125#define PSW32_MASK_WAIT 0x00020000UL
126#define PSW32_MASK_PSTATE 0x00010000UL
127#define PSW32_MASK_ASC 0x0000C000UL
128#define PSW32_MASK_CC 0x00003000UL
129#define PSW32_MASK_PM 0x00000f00UL
130
131#define PSW32_ADDR_AMODE31 0x80000000UL
132#define PSW32_ADDR_INSN 0x7FFFFFFFUL
133
134#define PSW32_BASE_BITS 0x00080000UL
135
136#define PSW32_ASC_PRIMARY 0x00000000UL
137#define PSW32_ASC_ACCREG 0x00004000UL
138#define PSW32_ASC_SECONDARY 0x00008000UL
139#define PSW32_ASC_HOME 0x0000C000UL
140
141#define PSW32_USER_BITS (PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME | \
142 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | \
143 PSW32_MASK_PSTATE)
144
145#define PSW32_MASK_MERGE(CURRENT,NEW) \
146 (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \
147 ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM)))
148
149
150typedef struct
151{
152 _psw_t32 psw;
153 __u32 gprs[__NUM_GPRS];
154 __u32 acrs[__NUM_ACRS];
155} _s390_regs_common32;
156
157typedef struct
158{
159 _s390_regs_common32 regs;
160 _s390_fp_regs32 fpregs;
161} _sigregs32;
162
163#define _SIGCONTEXT_NSIG32 64
164#define _SIGCONTEXT_NSIG_BPW32 32
165#define __SIGNAL_FRAMESIZE32 96
166#define _SIGMASK_COPY_SIZE32 (sizeof(u32)*2)
167
168struct sigcontext32
169{
170 __u32 oldmask[_COMPAT_NSIG_WORDS];
171 __u32 sregs; /* pointer */
172};
173
174/* asm/signal.h */
175struct sigaction32 {
176 __u32 sa_handler; /* pointer */
177 __u32 sa_flags;
178 __u32 sa_restorer; /* pointer */
179 compat_sigset_t sa_mask; /* mask last for extensibility */
180};
181
182typedef struct {
183 __u32 ss_sp; /* pointer */
184 int ss_flags;
185 compat_size_t ss_size;
186} stack_t32;
187
188/* asm/ucontext.h */
189struct ucontext32 {
190 __u32 uc_flags;
191 __u32 uc_link; /* pointer */
192 stack_t32 uc_stack;
193 _sigregs32 uc_mcontext;
194 compat_sigset_t uc_sigmask; /* mask last for extensibility */
195};
196
197#endif /* _ASM_S390X_S390_H */