xref: /linux/arch/s390/include/uapi/asm/ptrace.h (revision 9807f75955ea7f1877981056755284481873115c)
1*9807f759SDavid Howells /*
2*9807f759SDavid Howells  *  S390 version
3*9807f759SDavid Howells  *    Copyright IBM Corp. 1999, 2000
4*9807f759SDavid Howells  *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
5*9807f759SDavid Howells  */
6*9807f759SDavid Howells 
7*9807f759SDavid Howells #ifndef _UAPI_S390_PTRACE_H
8*9807f759SDavid Howells #define _UAPI_S390_PTRACE_H
9*9807f759SDavid Howells 
10*9807f759SDavid Howells /*
11*9807f759SDavid Howells  * Offsets in the user_regs_struct. They are used for the ptrace
12*9807f759SDavid Howells  * system call and in entry.S
13*9807f759SDavid Howells  */
14*9807f759SDavid Howells #ifndef __s390x__
15*9807f759SDavid Howells 
16*9807f759SDavid Howells #define PT_PSWMASK  0x00
17*9807f759SDavid Howells #define PT_PSWADDR  0x04
18*9807f759SDavid Howells #define PT_GPR0     0x08
19*9807f759SDavid Howells #define PT_GPR1     0x0C
20*9807f759SDavid Howells #define PT_GPR2     0x10
21*9807f759SDavid Howells #define PT_GPR3     0x14
22*9807f759SDavid Howells #define PT_GPR4     0x18
23*9807f759SDavid Howells #define PT_GPR5     0x1C
24*9807f759SDavid Howells #define PT_GPR6     0x20
25*9807f759SDavid Howells #define PT_GPR7     0x24
26*9807f759SDavid Howells #define PT_GPR8     0x28
27*9807f759SDavid Howells #define PT_GPR9     0x2C
28*9807f759SDavid Howells #define PT_GPR10    0x30
29*9807f759SDavid Howells #define PT_GPR11    0x34
30*9807f759SDavid Howells #define PT_GPR12    0x38
31*9807f759SDavid Howells #define PT_GPR13    0x3C
32*9807f759SDavid Howells #define PT_GPR14    0x40
33*9807f759SDavid Howells #define PT_GPR15    0x44
34*9807f759SDavid Howells #define PT_ACR0     0x48
35*9807f759SDavid Howells #define PT_ACR1     0x4C
36*9807f759SDavid Howells #define PT_ACR2     0x50
37*9807f759SDavid Howells #define PT_ACR3     0x54
38*9807f759SDavid Howells #define PT_ACR4	    0x58
39*9807f759SDavid Howells #define PT_ACR5	    0x5C
40*9807f759SDavid Howells #define PT_ACR6	    0x60
41*9807f759SDavid Howells #define PT_ACR7	    0x64
42*9807f759SDavid Howells #define PT_ACR8	    0x68
43*9807f759SDavid Howells #define PT_ACR9	    0x6C
44*9807f759SDavid Howells #define PT_ACR10    0x70
45*9807f759SDavid Howells #define PT_ACR11    0x74
46*9807f759SDavid Howells #define PT_ACR12    0x78
47*9807f759SDavid Howells #define PT_ACR13    0x7C
48*9807f759SDavid Howells #define PT_ACR14    0x80
49*9807f759SDavid Howells #define PT_ACR15    0x84
50*9807f759SDavid Howells #define PT_ORIGGPR2 0x88
51*9807f759SDavid Howells #define PT_FPC	    0x90
52*9807f759SDavid Howells /*
53*9807f759SDavid Howells  * A nasty fact of life that the ptrace api
54*9807f759SDavid Howells  * only supports passing of longs.
55*9807f759SDavid Howells  */
56*9807f759SDavid Howells #define PT_FPR0_HI  0x98
57*9807f759SDavid Howells #define PT_FPR0_LO  0x9C
58*9807f759SDavid Howells #define PT_FPR1_HI  0xA0
59*9807f759SDavid Howells #define PT_FPR1_LO  0xA4
60*9807f759SDavid Howells #define PT_FPR2_HI  0xA8
61*9807f759SDavid Howells #define PT_FPR2_LO  0xAC
62*9807f759SDavid Howells #define PT_FPR3_HI  0xB0
63*9807f759SDavid Howells #define PT_FPR3_LO  0xB4
64*9807f759SDavid Howells #define PT_FPR4_HI  0xB8
65*9807f759SDavid Howells #define PT_FPR4_LO  0xBC
66*9807f759SDavid Howells #define PT_FPR5_HI  0xC0
67*9807f759SDavid Howells #define PT_FPR5_LO  0xC4
68*9807f759SDavid Howells #define PT_FPR6_HI  0xC8
69*9807f759SDavid Howells #define PT_FPR6_LO  0xCC
70*9807f759SDavid Howells #define PT_FPR7_HI  0xD0
71*9807f759SDavid Howells #define PT_FPR7_LO  0xD4
72*9807f759SDavid Howells #define PT_FPR8_HI  0xD8
73*9807f759SDavid Howells #define PT_FPR8_LO  0XDC
74*9807f759SDavid Howells #define PT_FPR9_HI  0xE0
75*9807f759SDavid Howells #define PT_FPR9_LO  0xE4
76*9807f759SDavid Howells #define PT_FPR10_HI 0xE8
77*9807f759SDavid Howells #define PT_FPR10_LO 0xEC
78*9807f759SDavid Howells #define PT_FPR11_HI 0xF0
79*9807f759SDavid Howells #define PT_FPR11_LO 0xF4
80*9807f759SDavid Howells #define PT_FPR12_HI 0xF8
81*9807f759SDavid Howells #define PT_FPR12_LO 0xFC
82*9807f759SDavid Howells #define PT_FPR13_HI 0x100
83*9807f759SDavid Howells #define PT_FPR13_LO 0x104
84*9807f759SDavid Howells #define PT_FPR14_HI 0x108
85*9807f759SDavid Howells #define PT_FPR14_LO 0x10C
86*9807f759SDavid Howells #define PT_FPR15_HI 0x110
87*9807f759SDavid Howells #define PT_FPR15_LO 0x114
88*9807f759SDavid Howells #define PT_CR_9	    0x118
89*9807f759SDavid Howells #define PT_CR_10    0x11C
90*9807f759SDavid Howells #define PT_CR_11    0x120
91*9807f759SDavid Howells #define PT_IEEE_IP  0x13C
92*9807f759SDavid Howells #define PT_LASTOFF  PT_IEEE_IP
93*9807f759SDavid Howells #define PT_ENDREGS  0x140-1
94*9807f759SDavid Howells 
95*9807f759SDavid Howells #define GPR_SIZE	4
96*9807f759SDavid Howells #define CR_SIZE		4
97*9807f759SDavid Howells 
98*9807f759SDavid Howells #define STACK_FRAME_OVERHEAD	96	/* size of minimum stack frame */
99*9807f759SDavid Howells 
100*9807f759SDavid Howells #else /* __s390x__ */
101*9807f759SDavid Howells 
102*9807f759SDavid Howells #define PT_PSWMASK  0x00
103*9807f759SDavid Howells #define PT_PSWADDR  0x08
104*9807f759SDavid Howells #define PT_GPR0     0x10
105*9807f759SDavid Howells #define PT_GPR1     0x18
106*9807f759SDavid Howells #define PT_GPR2     0x20
107*9807f759SDavid Howells #define PT_GPR3     0x28
108*9807f759SDavid Howells #define PT_GPR4     0x30
109*9807f759SDavid Howells #define PT_GPR5     0x38
110*9807f759SDavid Howells #define PT_GPR6     0x40
111*9807f759SDavid Howells #define PT_GPR7     0x48
112*9807f759SDavid Howells #define PT_GPR8     0x50
113*9807f759SDavid Howells #define PT_GPR9     0x58
114*9807f759SDavid Howells #define PT_GPR10    0x60
115*9807f759SDavid Howells #define PT_GPR11    0x68
116*9807f759SDavid Howells #define PT_GPR12    0x70
117*9807f759SDavid Howells #define PT_GPR13    0x78
118*9807f759SDavid Howells #define PT_GPR14    0x80
119*9807f759SDavid Howells #define PT_GPR15    0x88
120*9807f759SDavid Howells #define PT_ACR0     0x90
121*9807f759SDavid Howells #define PT_ACR1     0x94
122*9807f759SDavid Howells #define PT_ACR2     0x98
123*9807f759SDavid Howells #define PT_ACR3     0x9C
124*9807f759SDavid Howells #define PT_ACR4	    0xA0
125*9807f759SDavid Howells #define PT_ACR5	    0xA4
126*9807f759SDavid Howells #define PT_ACR6	    0xA8
127*9807f759SDavid Howells #define PT_ACR7	    0xAC
128*9807f759SDavid Howells #define PT_ACR8	    0xB0
129*9807f759SDavid Howells #define PT_ACR9	    0xB4
130*9807f759SDavid Howells #define PT_ACR10    0xB8
131*9807f759SDavid Howells #define PT_ACR11    0xBC
132*9807f759SDavid Howells #define PT_ACR12    0xC0
133*9807f759SDavid Howells #define PT_ACR13    0xC4
134*9807f759SDavid Howells #define PT_ACR14    0xC8
135*9807f759SDavid Howells #define PT_ACR15    0xCC
136*9807f759SDavid Howells #define PT_ORIGGPR2 0xD0
137*9807f759SDavid Howells #define PT_FPC	    0xD8
138*9807f759SDavid Howells #define PT_FPR0     0xE0
139*9807f759SDavid Howells #define PT_FPR1     0xE8
140*9807f759SDavid Howells #define PT_FPR2     0xF0
141*9807f759SDavid Howells #define PT_FPR3     0xF8
142*9807f759SDavid Howells #define PT_FPR4     0x100
143*9807f759SDavid Howells #define PT_FPR5     0x108
144*9807f759SDavid Howells #define PT_FPR6     0x110
145*9807f759SDavid Howells #define PT_FPR7     0x118
146*9807f759SDavid Howells #define PT_FPR8     0x120
147*9807f759SDavid Howells #define PT_FPR9     0x128
148*9807f759SDavid Howells #define PT_FPR10    0x130
149*9807f759SDavid Howells #define PT_FPR11    0x138
150*9807f759SDavid Howells #define PT_FPR12    0x140
151*9807f759SDavid Howells #define PT_FPR13    0x148
152*9807f759SDavid Howells #define PT_FPR14    0x150
153*9807f759SDavid Howells #define PT_FPR15    0x158
154*9807f759SDavid Howells #define PT_CR_9     0x160
155*9807f759SDavid Howells #define PT_CR_10    0x168
156*9807f759SDavid Howells #define PT_CR_11    0x170
157*9807f759SDavid Howells #define PT_IEEE_IP  0x1A8
158*9807f759SDavid Howells #define PT_LASTOFF  PT_IEEE_IP
159*9807f759SDavid Howells #define PT_ENDREGS  0x1B0-1
160*9807f759SDavid Howells 
161*9807f759SDavid Howells #define GPR_SIZE	8
162*9807f759SDavid Howells #define CR_SIZE		8
163*9807f759SDavid Howells 
164*9807f759SDavid Howells #define STACK_FRAME_OVERHEAD    160      /* size of minimum stack frame */
165*9807f759SDavid Howells 
166*9807f759SDavid Howells #endif /* __s390x__ */
167*9807f759SDavid Howells 
168*9807f759SDavid Howells #define NUM_GPRS	16
169*9807f759SDavid Howells #define NUM_FPRS	16
170*9807f759SDavid Howells #define NUM_CRS		16
171*9807f759SDavid Howells #define NUM_ACRS	16
172*9807f759SDavid Howells 
173*9807f759SDavid Howells #define NUM_CR_WORDS	3
174*9807f759SDavid Howells 
175*9807f759SDavid Howells #define FPR_SIZE	8
176*9807f759SDavid Howells #define FPC_SIZE	4
177*9807f759SDavid Howells #define FPC_PAD_SIZE	4 /* gcc insists on aligning the fpregs */
178*9807f759SDavid Howells #define ACR_SIZE	4
179*9807f759SDavid Howells 
180*9807f759SDavid Howells 
181*9807f759SDavid Howells #define PTRACE_OLDSETOPTIONS         21
182*9807f759SDavid Howells 
183*9807f759SDavid Howells #ifndef __ASSEMBLY__
184*9807f759SDavid Howells #include <linux/stddef.h>
185*9807f759SDavid Howells #include <linux/types.h>
186*9807f759SDavid Howells 
187*9807f759SDavid Howells typedef union
188*9807f759SDavid Howells {
189*9807f759SDavid Howells 	float   f;
190*9807f759SDavid Howells 	double  d;
191*9807f759SDavid Howells         __u64   ui;
192*9807f759SDavid Howells 	struct
193*9807f759SDavid Howells 	{
194*9807f759SDavid Howells 		__u32 hi;
195*9807f759SDavid Howells 		__u32 lo;
196*9807f759SDavid Howells 	} fp;
197*9807f759SDavid Howells } freg_t;
198*9807f759SDavid Howells 
199*9807f759SDavid Howells typedef struct
200*9807f759SDavid Howells {
201*9807f759SDavid Howells 	__u32   fpc;
202*9807f759SDavid Howells 	freg_t  fprs[NUM_FPRS];
203*9807f759SDavid Howells } s390_fp_regs;
204*9807f759SDavid Howells 
205*9807f759SDavid Howells #define FPC_EXCEPTION_MASK      0xF8000000
206*9807f759SDavid Howells #define FPC_FLAGS_MASK          0x00F80000
207*9807f759SDavid Howells #define FPC_DXC_MASK            0x0000FF00
208*9807f759SDavid Howells #define FPC_RM_MASK             0x00000003
209*9807f759SDavid Howells #define FPC_VALID_MASK          0xF8F8FF03
210*9807f759SDavid Howells 
211*9807f759SDavid Howells /* this typedef defines how a Program Status Word looks like */
212*9807f759SDavid Howells typedef struct
213*9807f759SDavid Howells {
214*9807f759SDavid Howells         unsigned long mask;
215*9807f759SDavid Howells         unsigned long addr;
216*9807f759SDavid Howells } __attribute__ ((aligned(8))) psw_t;
217*9807f759SDavid Howells 
218*9807f759SDavid Howells typedef struct
219*9807f759SDavid Howells {
220*9807f759SDavid Howells 	__u32	mask;
221*9807f759SDavid Howells 	__u32	addr;
222*9807f759SDavid Howells } __attribute__ ((aligned(8))) psw_compat_t;
223*9807f759SDavid Howells 
224*9807f759SDavid Howells #ifndef __s390x__
225*9807f759SDavid Howells 
226*9807f759SDavid Howells #define PSW_MASK_PER		0x40000000UL
227*9807f759SDavid Howells #define PSW_MASK_DAT		0x04000000UL
228*9807f759SDavid Howells #define PSW_MASK_IO		0x02000000UL
229*9807f759SDavid Howells #define PSW_MASK_EXT		0x01000000UL
230*9807f759SDavid Howells #define PSW_MASK_KEY		0x00F00000UL
231*9807f759SDavid Howells #define PSW_MASK_BASE		0x00080000UL	/* always one */
232*9807f759SDavid Howells #define PSW_MASK_MCHECK		0x00040000UL
233*9807f759SDavid Howells #define PSW_MASK_WAIT		0x00020000UL
234*9807f759SDavid Howells #define PSW_MASK_PSTATE		0x00010000UL
235*9807f759SDavid Howells #define PSW_MASK_ASC		0x0000C000UL
236*9807f759SDavid Howells #define PSW_MASK_CC		0x00003000UL
237*9807f759SDavid Howells #define PSW_MASK_PM		0x00000F00UL
238*9807f759SDavid Howells #define PSW_MASK_RI		0x00000000UL
239*9807f759SDavid Howells #define PSW_MASK_EA		0x00000000UL
240*9807f759SDavid Howells #define PSW_MASK_BA		0x00000000UL
241*9807f759SDavid Howells 
242*9807f759SDavid Howells #define PSW_MASK_USER		0x00003F00UL
243*9807f759SDavid Howells 
244*9807f759SDavid Howells #define PSW_ADDR_AMODE		0x80000000UL
245*9807f759SDavid Howells #define PSW_ADDR_INSN		0x7FFFFFFFUL
246*9807f759SDavid Howells 
247*9807f759SDavid Howells #define PSW_DEFAULT_KEY		(((unsigned long) PAGE_DEFAULT_ACC) << 20)
248*9807f759SDavid Howells 
249*9807f759SDavid Howells #define PSW_ASC_PRIMARY		0x00000000UL
250*9807f759SDavid Howells #define PSW_ASC_ACCREG		0x00004000UL
251*9807f759SDavid Howells #define PSW_ASC_SECONDARY	0x00008000UL
252*9807f759SDavid Howells #define PSW_ASC_HOME		0x0000C000UL
253*9807f759SDavid Howells 
254*9807f759SDavid Howells #else /* __s390x__ */
255*9807f759SDavid Howells 
256*9807f759SDavid Howells #define PSW_MASK_PER		0x4000000000000000UL
257*9807f759SDavid Howells #define PSW_MASK_DAT		0x0400000000000000UL
258*9807f759SDavid Howells #define PSW_MASK_IO		0x0200000000000000UL
259*9807f759SDavid Howells #define PSW_MASK_EXT		0x0100000000000000UL
260*9807f759SDavid Howells #define PSW_MASK_BASE		0x0000000000000000UL
261*9807f759SDavid Howells #define PSW_MASK_KEY		0x00F0000000000000UL
262*9807f759SDavid Howells #define PSW_MASK_MCHECK		0x0004000000000000UL
263*9807f759SDavid Howells #define PSW_MASK_WAIT		0x0002000000000000UL
264*9807f759SDavid Howells #define PSW_MASK_PSTATE		0x0001000000000000UL
265*9807f759SDavid Howells #define PSW_MASK_ASC		0x0000C00000000000UL
266*9807f759SDavid Howells #define PSW_MASK_CC		0x0000300000000000UL
267*9807f759SDavid Howells #define PSW_MASK_PM		0x00000F0000000000UL
268*9807f759SDavid Howells #define PSW_MASK_RI		0x0000008000000000UL
269*9807f759SDavid Howells #define PSW_MASK_EA		0x0000000100000000UL
270*9807f759SDavid Howells #define PSW_MASK_BA		0x0000000080000000UL
271*9807f759SDavid Howells 
272*9807f759SDavid Howells #define PSW_MASK_USER		0x00003F8180000000UL
273*9807f759SDavid Howells 
274*9807f759SDavid Howells #define PSW_ADDR_AMODE		0x0000000000000000UL
275*9807f759SDavid Howells #define PSW_ADDR_INSN		0xFFFFFFFFFFFFFFFFUL
276*9807f759SDavid Howells 
277*9807f759SDavid Howells #define PSW_DEFAULT_KEY		(((unsigned long) PAGE_DEFAULT_ACC) << 52)
278*9807f759SDavid Howells 
279*9807f759SDavid Howells #define PSW_ASC_PRIMARY		0x0000000000000000UL
280*9807f759SDavid Howells #define PSW_ASC_ACCREG		0x0000400000000000UL
281*9807f759SDavid Howells #define PSW_ASC_SECONDARY	0x0000800000000000UL
282*9807f759SDavid Howells #define PSW_ASC_HOME		0x0000C00000000000UL
283*9807f759SDavid Howells 
284*9807f759SDavid Howells #endif /* __s390x__ */
285*9807f759SDavid Howells 
286*9807f759SDavid Howells 
287*9807f759SDavid Howells /*
288*9807f759SDavid Howells  * The s390_regs structure is used to define the elf_gregset_t.
289*9807f759SDavid Howells  */
290*9807f759SDavid Howells typedef struct
291*9807f759SDavid Howells {
292*9807f759SDavid Howells 	psw_t psw;
293*9807f759SDavid Howells 	unsigned long gprs[NUM_GPRS];
294*9807f759SDavid Howells 	unsigned int  acrs[NUM_ACRS];
295*9807f759SDavid Howells 	unsigned long orig_gpr2;
296*9807f759SDavid Howells } s390_regs;
297*9807f759SDavid Howells 
298*9807f759SDavid Howells typedef struct
299*9807f759SDavid Howells {
300*9807f759SDavid Howells 	psw_compat_t	psw;
301*9807f759SDavid Howells 	__u32		gprs[NUM_GPRS];
302*9807f759SDavid Howells 	__u32		acrs[NUM_ACRS];
303*9807f759SDavid Howells 	__u32		orig_gpr2;
304*9807f759SDavid Howells } s390_compat_regs;
305*9807f759SDavid Howells 
306*9807f759SDavid Howells typedef struct
307*9807f759SDavid Howells {
308*9807f759SDavid Howells 	__u32		gprs_high[NUM_GPRS];
309*9807f759SDavid Howells } s390_compat_regs_high;
310*9807f759SDavid Howells 
311*9807f759SDavid Howells 
312*9807f759SDavid Howells /*
313*9807f759SDavid Howells  * Now for the user space program event recording (trace) definitions.
314*9807f759SDavid Howells  * The following structures are used only for the ptrace interface, don't
315*9807f759SDavid Howells  * touch or even look at it if you don't want to modify the user-space
316*9807f759SDavid Howells  * ptrace interface. In particular stay away from it for in-kernel PER.
317*9807f759SDavid Howells  */
318*9807f759SDavid Howells typedef struct
319*9807f759SDavid Howells {
320*9807f759SDavid Howells 	unsigned long cr[NUM_CR_WORDS];
321*9807f759SDavid Howells } per_cr_words;
322*9807f759SDavid Howells 
323*9807f759SDavid Howells #define PER_EM_MASK 0xE8000000UL
324*9807f759SDavid Howells 
325*9807f759SDavid Howells typedef	struct
326*9807f759SDavid Howells {
327*9807f759SDavid Howells #ifdef __s390x__
328*9807f759SDavid Howells 	unsigned                       : 32;
329*9807f759SDavid Howells #endif /* __s390x__ */
330*9807f759SDavid Howells 	unsigned em_branching          : 1;
331*9807f759SDavid Howells 	unsigned em_instruction_fetch  : 1;
332*9807f759SDavid Howells 	/*
333*9807f759SDavid Howells 	 * Switching on storage alteration automatically fixes
334*9807f759SDavid Howells 	 * the storage alteration event bit in the users std.
335*9807f759SDavid Howells 	 */
336*9807f759SDavid Howells 	unsigned em_storage_alteration : 1;
337*9807f759SDavid Howells 	unsigned em_gpr_alt_unused     : 1;
338*9807f759SDavid Howells 	unsigned em_store_real_address : 1;
339*9807f759SDavid Howells 	unsigned                       : 3;
340*9807f759SDavid Howells 	unsigned branch_addr_ctl       : 1;
341*9807f759SDavid Howells 	unsigned                       : 1;
342*9807f759SDavid Howells 	unsigned storage_alt_space_ctl : 1;
343*9807f759SDavid Howells 	unsigned                       : 21;
344*9807f759SDavid Howells 	unsigned long starting_addr;
345*9807f759SDavid Howells 	unsigned long ending_addr;
346*9807f759SDavid Howells } per_cr_bits;
347*9807f759SDavid Howells 
348*9807f759SDavid Howells typedef struct
349*9807f759SDavid Howells {
350*9807f759SDavid Howells 	unsigned short perc_atmid;
351*9807f759SDavid Howells 	unsigned long address;
352*9807f759SDavid Howells 	unsigned char access_id;
353*9807f759SDavid Howells } per_lowcore_words;
354*9807f759SDavid Howells 
355*9807f759SDavid Howells typedef struct
356*9807f759SDavid Howells {
357*9807f759SDavid Howells 	unsigned perc_branching          : 1;
358*9807f759SDavid Howells 	unsigned perc_instruction_fetch  : 1;
359*9807f759SDavid Howells 	unsigned perc_storage_alteration : 1;
360*9807f759SDavid Howells 	unsigned perc_gpr_alt_unused     : 1;
361*9807f759SDavid Howells 	unsigned perc_store_real_address : 1;
362*9807f759SDavid Howells 	unsigned                         : 3;
363*9807f759SDavid Howells 	unsigned atmid_psw_bit_31        : 1;
364*9807f759SDavid Howells 	unsigned atmid_validity_bit      : 1;
365*9807f759SDavid Howells 	unsigned atmid_psw_bit_32        : 1;
366*9807f759SDavid Howells 	unsigned atmid_psw_bit_5         : 1;
367*9807f759SDavid Howells 	unsigned atmid_psw_bit_16        : 1;
368*9807f759SDavid Howells 	unsigned atmid_psw_bit_17        : 1;
369*9807f759SDavid Howells 	unsigned si                      : 2;
370*9807f759SDavid Howells 	unsigned long address;
371*9807f759SDavid Howells 	unsigned                         : 4;
372*9807f759SDavid Howells 	unsigned access_id               : 4;
373*9807f759SDavid Howells } per_lowcore_bits;
374*9807f759SDavid Howells 
375*9807f759SDavid Howells typedef struct
376*9807f759SDavid Howells {
377*9807f759SDavid Howells 	union {
378*9807f759SDavid Howells 		per_cr_words   words;
379*9807f759SDavid Howells 		per_cr_bits    bits;
380*9807f759SDavid Howells 	} control_regs;
381*9807f759SDavid Howells 	/*
382*9807f759SDavid Howells 	 * Use these flags instead of setting em_instruction_fetch
383*9807f759SDavid Howells 	 * directly they are used so that single stepping can be
384*9807f759SDavid Howells 	 * switched on & off while not affecting other tracing
385*9807f759SDavid Howells 	 */
386*9807f759SDavid Howells 	unsigned  single_step       : 1;
387*9807f759SDavid Howells 	unsigned  instruction_fetch : 1;
388*9807f759SDavid Howells 	unsigned                    : 30;
389*9807f759SDavid Howells 	/*
390*9807f759SDavid Howells 	 * These addresses are copied into cr10 & cr11 if single
391*9807f759SDavid Howells 	 * stepping is switched off
392*9807f759SDavid Howells 	 */
393*9807f759SDavid Howells 	unsigned long starting_addr;
394*9807f759SDavid Howells 	unsigned long ending_addr;
395*9807f759SDavid Howells 	union {
396*9807f759SDavid Howells 		per_lowcore_words words;
397*9807f759SDavid Howells 		per_lowcore_bits  bits;
398*9807f759SDavid Howells 	} lowcore;
399*9807f759SDavid Howells } per_struct;
400*9807f759SDavid Howells 
401*9807f759SDavid Howells typedef struct
402*9807f759SDavid Howells {
403*9807f759SDavid Howells 	unsigned int  len;
404*9807f759SDavid Howells 	unsigned long kernel_addr;
405*9807f759SDavid Howells 	unsigned long process_addr;
406*9807f759SDavid Howells } ptrace_area;
407*9807f759SDavid Howells 
408*9807f759SDavid Howells /*
409*9807f759SDavid Howells  * S/390 specific non posix ptrace requests. I chose unusual values so
410*9807f759SDavid Howells  * they are unlikely to clash with future ptrace definitions.
411*9807f759SDavid Howells  */
412*9807f759SDavid Howells #define PTRACE_PEEKUSR_AREA           0x5000
413*9807f759SDavid Howells #define PTRACE_POKEUSR_AREA           0x5001
414*9807f759SDavid Howells #define PTRACE_PEEKTEXT_AREA	      0x5002
415*9807f759SDavid Howells #define PTRACE_PEEKDATA_AREA	      0x5003
416*9807f759SDavid Howells #define PTRACE_POKETEXT_AREA	      0x5004
417*9807f759SDavid Howells #define PTRACE_POKEDATA_AREA 	      0x5005
418*9807f759SDavid Howells #define PTRACE_GET_LAST_BREAK	      0x5006
419*9807f759SDavid Howells #define PTRACE_PEEK_SYSTEM_CALL       0x5007
420*9807f759SDavid Howells #define PTRACE_POKE_SYSTEM_CALL	      0x5008
421*9807f759SDavid Howells #define PTRACE_ENABLE_TE	      0x5009
422*9807f759SDavid Howells #define PTRACE_DISABLE_TE	      0x5010
423*9807f759SDavid Howells 
424*9807f759SDavid Howells /*
425*9807f759SDavid Howells  * PT_PROT definition is loosely based on hppa bsd definition in
426*9807f759SDavid Howells  * gdb/hppab-nat.c
427*9807f759SDavid Howells  */
428*9807f759SDavid Howells #define PTRACE_PROT                       21
429*9807f759SDavid Howells 
430*9807f759SDavid Howells typedef enum
431*9807f759SDavid Howells {
432*9807f759SDavid Howells 	ptprot_set_access_watchpoint,
433*9807f759SDavid Howells 	ptprot_set_write_watchpoint,
434*9807f759SDavid Howells 	ptprot_disable_watchpoint
435*9807f759SDavid Howells } ptprot_flags;
436*9807f759SDavid Howells 
437*9807f759SDavid Howells typedef struct
438*9807f759SDavid Howells {
439*9807f759SDavid Howells 	unsigned long lowaddr;
440*9807f759SDavid Howells 	unsigned long hiaddr;
441*9807f759SDavid Howells 	ptprot_flags prot;
442*9807f759SDavid Howells } ptprot_area;
443*9807f759SDavid Howells 
444*9807f759SDavid Howells /* Sequence of bytes for breakpoint illegal instruction.  */
445*9807f759SDavid Howells #define S390_BREAKPOINT     {0x0,0x1}
446*9807f759SDavid Howells #define S390_BREAKPOINT_U16 ((__u16)0x0001)
447*9807f759SDavid Howells #define S390_SYSCALL_OPCODE ((__u16)0x0a00)
448*9807f759SDavid Howells #define S390_SYSCALL_SIZE   2
449*9807f759SDavid Howells 
450*9807f759SDavid Howells /*
451*9807f759SDavid Howells  * The user_regs_struct defines the way the user registers are
452*9807f759SDavid Howells  * store on the stack for signal handling.
453*9807f759SDavid Howells  */
454*9807f759SDavid Howells struct user_regs_struct
455*9807f759SDavid Howells {
456*9807f759SDavid Howells 	psw_t psw;
457*9807f759SDavid Howells 	unsigned long gprs[NUM_GPRS];
458*9807f759SDavid Howells 	unsigned int  acrs[NUM_ACRS];
459*9807f759SDavid Howells 	unsigned long orig_gpr2;
460*9807f759SDavid Howells 	s390_fp_regs fp_regs;
461*9807f759SDavid Howells 	/*
462*9807f759SDavid Howells 	 * These per registers are in here so that gdb can modify them
463*9807f759SDavid Howells 	 * itself as there is no "official" ptrace interface for hardware
464*9807f759SDavid Howells 	 * watchpoints. This is the way intel does it.
465*9807f759SDavid Howells 	 */
466*9807f759SDavid Howells 	per_struct per_info;
467*9807f759SDavid Howells 	unsigned long ieee_instruction_pointer;	/* obsolete, always 0 */
468*9807f759SDavid Howells };
469*9807f759SDavid Howells 
470*9807f759SDavid Howells #endif /* __ASSEMBLY__ */
471*9807f759SDavid Howells 
472*9807f759SDavid Howells #endif /* _UAPI_S390_PTRACE_H */
473