xref: /linux/arch/s390/include/uapi/asm/ptrace.h (revision b8af5999779d1225c82fcc960223625b279f5f0d)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
29807f759SDavid Howells /*
39807f759SDavid Howells  *  S390 version
49807f759SDavid Howells  *    Copyright IBM Corp. 1999, 2000
59807f759SDavid Howells  *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
69807f759SDavid Howells  */
79807f759SDavid Howells 
89807f759SDavid Howells #ifndef _UAPI_S390_PTRACE_H
99807f759SDavid Howells #define _UAPI_S390_PTRACE_H
109807f759SDavid Howells 
119807f759SDavid Howells /*
129807f759SDavid Howells  * Offsets in the user_regs_struct. They are used for the ptrace
139807f759SDavid Howells  * system call and in entry.S
149807f759SDavid Howells  */
159807f759SDavid Howells #ifndef __s390x__
169807f759SDavid Howells 
179807f759SDavid Howells #define PT_PSWMASK  0x00
189807f759SDavid Howells #define PT_PSWADDR  0x04
199807f759SDavid Howells #define PT_GPR0     0x08
209807f759SDavid Howells #define PT_GPR1     0x0C
219807f759SDavid Howells #define PT_GPR2     0x10
229807f759SDavid Howells #define PT_GPR3     0x14
239807f759SDavid Howells #define PT_GPR4     0x18
249807f759SDavid Howells #define PT_GPR5     0x1C
259807f759SDavid Howells #define PT_GPR6     0x20
269807f759SDavid Howells #define PT_GPR7     0x24
279807f759SDavid Howells #define PT_GPR8     0x28
289807f759SDavid Howells #define PT_GPR9     0x2C
299807f759SDavid Howells #define PT_GPR10    0x30
309807f759SDavid Howells #define PT_GPR11    0x34
319807f759SDavid Howells #define PT_GPR12    0x38
329807f759SDavid Howells #define PT_GPR13    0x3C
339807f759SDavid Howells #define PT_GPR14    0x40
349807f759SDavid Howells #define PT_GPR15    0x44
359807f759SDavid Howells #define PT_ACR0     0x48
369807f759SDavid Howells #define PT_ACR1     0x4C
379807f759SDavid Howells #define PT_ACR2     0x50
389807f759SDavid Howells #define PT_ACR3     0x54
399807f759SDavid Howells #define PT_ACR4	    0x58
409807f759SDavid Howells #define PT_ACR5	    0x5C
419807f759SDavid Howells #define PT_ACR6	    0x60
429807f759SDavid Howells #define PT_ACR7	    0x64
439807f759SDavid Howells #define PT_ACR8	    0x68
449807f759SDavid Howells #define PT_ACR9	    0x6C
459807f759SDavid Howells #define PT_ACR10    0x70
469807f759SDavid Howells #define PT_ACR11    0x74
479807f759SDavid Howells #define PT_ACR12    0x78
489807f759SDavid Howells #define PT_ACR13    0x7C
499807f759SDavid Howells #define PT_ACR14    0x80
509807f759SDavid Howells #define PT_ACR15    0x84
519807f759SDavid Howells #define PT_ORIGGPR2 0x88
529807f759SDavid Howells #define PT_FPC	    0x90
539807f759SDavid Howells /*
549807f759SDavid Howells  * A nasty fact of life that the ptrace api
559807f759SDavid Howells  * only supports passing of longs.
569807f759SDavid Howells  */
579807f759SDavid Howells #define PT_FPR0_HI  0x98
589807f759SDavid Howells #define PT_FPR0_LO  0x9C
599807f759SDavid Howells #define PT_FPR1_HI  0xA0
609807f759SDavid Howells #define PT_FPR1_LO  0xA4
619807f759SDavid Howells #define PT_FPR2_HI  0xA8
629807f759SDavid Howells #define PT_FPR2_LO  0xAC
639807f759SDavid Howells #define PT_FPR3_HI  0xB0
649807f759SDavid Howells #define PT_FPR3_LO  0xB4
659807f759SDavid Howells #define PT_FPR4_HI  0xB8
669807f759SDavid Howells #define PT_FPR4_LO  0xBC
679807f759SDavid Howells #define PT_FPR5_HI  0xC0
689807f759SDavid Howells #define PT_FPR5_LO  0xC4
699807f759SDavid Howells #define PT_FPR6_HI  0xC8
709807f759SDavid Howells #define PT_FPR6_LO  0xCC
719807f759SDavid Howells #define PT_FPR7_HI  0xD0
729807f759SDavid Howells #define PT_FPR7_LO  0xD4
739807f759SDavid Howells #define PT_FPR8_HI  0xD8
749807f759SDavid Howells #define PT_FPR8_LO  0XDC
759807f759SDavid Howells #define PT_FPR9_HI  0xE0
769807f759SDavid Howells #define PT_FPR9_LO  0xE4
779807f759SDavid Howells #define PT_FPR10_HI 0xE8
789807f759SDavid Howells #define PT_FPR10_LO 0xEC
799807f759SDavid Howells #define PT_FPR11_HI 0xF0
809807f759SDavid Howells #define PT_FPR11_LO 0xF4
819807f759SDavid Howells #define PT_FPR12_HI 0xF8
829807f759SDavid Howells #define PT_FPR12_LO 0xFC
839807f759SDavid Howells #define PT_FPR13_HI 0x100
849807f759SDavid Howells #define PT_FPR13_LO 0x104
859807f759SDavid Howells #define PT_FPR14_HI 0x108
869807f759SDavid Howells #define PT_FPR14_LO 0x10C
879807f759SDavid Howells #define PT_FPR15_HI 0x110
889807f759SDavid Howells #define PT_FPR15_LO 0x114
899807f759SDavid Howells #define PT_CR_9	    0x118
909807f759SDavid Howells #define PT_CR_10    0x11C
919807f759SDavid Howells #define PT_CR_11    0x120
929807f759SDavid Howells #define PT_IEEE_IP  0x13C
939807f759SDavid Howells #define PT_LASTOFF  PT_IEEE_IP
949807f759SDavid Howells #define PT_ENDREGS  0x140-1
959807f759SDavid Howells 
969807f759SDavid Howells #define GPR_SIZE	4
979807f759SDavid Howells #define CR_SIZE		4
989807f759SDavid Howells 
999807f759SDavid Howells #define STACK_FRAME_OVERHEAD	96	/* size of minimum stack frame */
1009807f759SDavid Howells 
1019807f759SDavid Howells #else /* __s390x__ */
1029807f759SDavid Howells 
1039807f759SDavid Howells #define PT_PSWMASK  0x00
1049807f759SDavid Howells #define PT_PSWADDR  0x08
1059807f759SDavid Howells #define PT_GPR0     0x10
1069807f759SDavid Howells #define PT_GPR1     0x18
1079807f759SDavid Howells #define PT_GPR2     0x20
1089807f759SDavid Howells #define PT_GPR3     0x28
1099807f759SDavid Howells #define PT_GPR4     0x30
1109807f759SDavid Howells #define PT_GPR5     0x38
1119807f759SDavid Howells #define PT_GPR6     0x40
1129807f759SDavid Howells #define PT_GPR7     0x48
1139807f759SDavid Howells #define PT_GPR8     0x50
1149807f759SDavid Howells #define PT_GPR9     0x58
1159807f759SDavid Howells #define PT_GPR10    0x60
1169807f759SDavid Howells #define PT_GPR11    0x68
1179807f759SDavid Howells #define PT_GPR12    0x70
1189807f759SDavid Howells #define PT_GPR13    0x78
1199807f759SDavid Howells #define PT_GPR14    0x80
1209807f759SDavid Howells #define PT_GPR15    0x88
1219807f759SDavid Howells #define PT_ACR0     0x90
1229807f759SDavid Howells #define PT_ACR1     0x94
1239807f759SDavid Howells #define PT_ACR2     0x98
1249807f759SDavid Howells #define PT_ACR3     0x9C
1259807f759SDavid Howells #define PT_ACR4	    0xA0
1269807f759SDavid Howells #define PT_ACR5	    0xA4
1279807f759SDavid Howells #define PT_ACR6	    0xA8
1289807f759SDavid Howells #define PT_ACR7	    0xAC
1299807f759SDavid Howells #define PT_ACR8	    0xB0
1309807f759SDavid Howells #define PT_ACR9	    0xB4
1319807f759SDavid Howells #define PT_ACR10    0xB8
1329807f759SDavid Howells #define PT_ACR11    0xBC
1339807f759SDavid Howells #define PT_ACR12    0xC0
1349807f759SDavid Howells #define PT_ACR13    0xC4
1359807f759SDavid Howells #define PT_ACR14    0xC8
1369807f759SDavid Howells #define PT_ACR15    0xCC
1379807f759SDavid Howells #define PT_ORIGGPR2 0xD0
1389807f759SDavid Howells #define PT_FPC	    0xD8
1399807f759SDavid Howells #define PT_FPR0     0xE0
1409807f759SDavid Howells #define PT_FPR1     0xE8
1419807f759SDavid Howells #define PT_FPR2     0xF0
1429807f759SDavid Howells #define PT_FPR3     0xF8
1439807f759SDavid Howells #define PT_FPR4     0x100
1449807f759SDavid Howells #define PT_FPR5     0x108
1459807f759SDavid Howells #define PT_FPR6     0x110
1469807f759SDavid Howells #define PT_FPR7     0x118
1479807f759SDavid Howells #define PT_FPR8     0x120
1489807f759SDavid Howells #define PT_FPR9     0x128
1499807f759SDavid Howells #define PT_FPR10    0x130
1509807f759SDavid Howells #define PT_FPR11    0x138
1519807f759SDavid Howells #define PT_FPR12    0x140
1529807f759SDavid Howells #define PT_FPR13    0x148
1539807f759SDavid Howells #define PT_FPR14    0x150
1549807f759SDavid Howells #define PT_FPR15    0x158
1559807f759SDavid Howells #define PT_CR_9     0x160
1569807f759SDavid Howells #define PT_CR_10    0x168
1579807f759SDavid Howells #define PT_CR_11    0x170
1589807f759SDavid Howells #define PT_IEEE_IP  0x1A8
1599807f759SDavid Howells #define PT_LASTOFF  PT_IEEE_IP
1609807f759SDavid Howells #define PT_ENDREGS  0x1B0-1
1619807f759SDavid Howells 
1629807f759SDavid Howells #define GPR_SIZE	8
1639807f759SDavid Howells #define CR_SIZE		8
1649807f759SDavid Howells 
1659807f759SDavid Howells #define STACK_FRAME_OVERHEAD	160	 /* size of minimum stack frame */
1669807f759SDavid Howells 
1679807f759SDavid Howells #endif /* __s390x__ */
1689807f759SDavid Howells 
169*b8af5999SHeiko Carstens #ifndef __s390x__
170*b8af5999SHeiko Carstens 
171*b8af5999SHeiko Carstens #define PSW_MASK_PER		_AC(0x40000000, UL)
172*b8af5999SHeiko Carstens #define PSW_MASK_DAT		_AC(0x04000000, UL)
173*b8af5999SHeiko Carstens #define PSW_MASK_IO		_AC(0x02000000, UL)
174*b8af5999SHeiko Carstens #define PSW_MASK_EXT		_AC(0x01000000, UL)
175*b8af5999SHeiko Carstens #define PSW_MASK_KEY		_AC(0x00F00000, UL)
176*b8af5999SHeiko Carstens #define PSW_MASK_BASE		_AC(0x00080000, UL)	/* always one */
177*b8af5999SHeiko Carstens #define PSW_MASK_MCHECK		_AC(0x00040000, UL)
178*b8af5999SHeiko Carstens #define PSW_MASK_WAIT		_AC(0x00020000, UL)
179*b8af5999SHeiko Carstens #define PSW_MASK_PSTATE		_AC(0x00010000, UL)
180*b8af5999SHeiko Carstens #define PSW_MASK_ASC		_AC(0x0000C000, UL)
181*b8af5999SHeiko Carstens #define PSW_MASK_CC		_AC(0x00003000, UL)
182*b8af5999SHeiko Carstens #define PSW_MASK_PM		_AC(0x00000F00, UL)
183*b8af5999SHeiko Carstens #define PSW_MASK_RI		_AC(0x00000000, UL)
184*b8af5999SHeiko Carstens #define PSW_MASK_EA		_AC(0x00000000, UL)
185*b8af5999SHeiko Carstens #define PSW_MASK_BA		_AC(0x00000000, UL)
186*b8af5999SHeiko Carstens 
187*b8af5999SHeiko Carstens #define PSW_MASK_USER		_AC(0x0000FF00, UL)
188*b8af5999SHeiko Carstens 
189*b8af5999SHeiko Carstens #define PSW_ADDR_AMODE		_AC(0x80000000, UL)
190*b8af5999SHeiko Carstens #define PSW_ADDR_INSN		_AC(0x7FFFFFFF, UL)
191*b8af5999SHeiko Carstens 
192*b8af5999SHeiko Carstens #define PSW_ASC_PRIMARY		_AC(0x00000000, UL)
193*b8af5999SHeiko Carstens #define PSW_ASC_ACCREG		_AC(0x00004000, UL)
194*b8af5999SHeiko Carstens #define PSW_ASC_SECONDARY	_AC(0x00008000, UL)
195*b8af5999SHeiko Carstens #define PSW_ASC_HOME		_AC(0x0000C000, UL)
196*b8af5999SHeiko Carstens 
197*b8af5999SHeiko Carstens #else /* __s390x__ */
198*b8af5999SHeiko Carstens 
199*b8af5999SHeiko Carstens #define PSW_MASK_PER		_AC(0x4000000000000000, UL)
200*b8af5999SHeiko Carstens #define PSW_MASK_DAT		_AC(0x0400000000000000, UL)
201*b8af5999SHeiko Carstens #define PSW_MASK_IO		_AC(0x0200000000000000, UL)
202*b8af5999SHeiko Carstens #define PSW_MASK_EXT		_AC(0x0100000000000000, UL)
203*b8af5999SHeiko Carstens #define PSW_MASK_BASE		_AC(0x0000000000000000, UL)
204*b8af5999SHeiko Carstens #define PSW_MASK_KEY		_AC(0x00F0000000000000, UL)
205*b8af5999SHeiko Carstens #define PSW_MASK_MCHECK		_AC(0x0004000000000000, UL)
206*b8af5999SHeiko Carstens #define PSW_MASK_WAIT		_AC(0x0002000000000000, UL)
207*b8af5999SHeiko Carstens #define PSW_MASK_PSTATE		_AC(0x0001000000000000, UL)
208*b8af5999SHeiko Carstens #define PSW_MASK_ASC		_AC(0x0000C00000000000, UL)
209*b8af5999SHeiko Carstens #define PSW_MASK_CC		_AC(0x0000300000000000, UL)
210*b8af5999SHeiko Carstens #define PSW_MASK_PM		_AC(0x00000F0000000000, UL)
211*b8af5999SHeiko Carstens #define PSW_MASK_RI		_AC(0x0000008000000000, UL)
212*b8af5999SHeiko Carstens #define PSW_MASK_EA		_AC(0x0000000100000000, UL)
213*b8af5999SHeiko Carstens #define PSW_MASK_BA		_AC(0x0000000080000000, UL)
214*b8af5999SHeiko Carstens 
215*b8af5999SHeiko Carstens #define PSW_MASK_USER		_AC(0x0000FF0180000000, UL)
216*b8af5999SHeiko Carstens 
217*b8af5999SHeiko Carstens #define PSW_ADDR_AMODE		_AC(0x0000000000000000, UL)
218*b8af5999SHeiko Carstens #define PSW_ADDR_INSN		_AC(0xFFFFFFFFFFFFFFFF, UL)
219*b8af5999SHeiko Carstens 
220*b8af5999SHeiko Carstens #define PSW_ASC_PRIMARY		_AC(0x0000000000000000, UL)
221*b8af5999SHeiko Carstens #define PSW_ASC_ACCREG		_AC(0x0000400000000000, UL)
222*b8af5999SHeiko Carstens #define PSW_ASC_SECONDARY	_AC(0x0000800000000000, UL)
223*b8af5999SHeiko Carstens #define PSW_ASC_HOME		_AC(0x0000C00000000000, UL)
224*b8af5999SHeiko Carstens 
225*b8af5999SHeiko Carstens #endif /* __s390x__ */
226*b8af5999SHeiko Carstens 
2279807f759SDavid Howells #define NUM_GPRS	16
2289807f759SDavid Howells #define NUM_FPRS	16
2299807f759SDavid Howells #define NUM_CRS		16
2309807f759SDavid Howells #define NUM_ACRS	16
2319807f759SDavid Howells 
2329807f759SDavid Howells #define NUM_CR_WORDS	3
2339807f759SDavid Howells 
2349807f759SDavid Howells #define FPR_SIZE	8
2359807f759SDavid Howells #define FPC_SIZE	4
2369807f759SDavid Howells #define FPC_PAD_SIZE	4 /* gcc insists on aligning the fpregs */
2379807f759SDavid Howells #define ACR_SIZE	4
2389807f759SDavid Howells 
2399807f759SDavid Howells 
2409807f759SDavid Howells #define PTRACE_OLDSETOPTIONS		21
24156e62a73SSven Schnelle #define PTRACE_SYSEMU			31
24256e62a73SSven Schnelle #define PTRACE_SYSEMU_SINGLESTEP	32
2439807f759SDavid Howells #ifndef __ASSEMBLY__
2449807f759SDavid Howells #include <linux/stddef.h>
2459807f759SDavid Howells #include <linux/types.h>
2469807f759SDavid Howells 
24762e1dfa3SHendrik Brueckner typedef union {
2489807f759SDavid Howells 	float	f;
2499807f759SDavid Howells 	double	d;
2509807f759SDavid Howells 	__u64	ui;
2519807f759SDavid Howells 	struct
2529807f759SDavid Howells 	{
2539807f759SDavid Howells 		__u32 hi;
2549807f759SDavid Howells 		__u32 lo;
2559807f759SDavid Howells 	} fp;
2569807f759SDavid Howells } freg_t;
2579807f759SDavid Howells 
25862e1dfa3SHendrik Brueckner typedef struct {
2599807f759SDavid Howells 	__u32	fpc;
2604725c860SMartin Schwidefsky 	__u32	pad;
2619807f759SDavid Howells 	freg_t	fprs[NUM_FPRS];
2629807f759SDavid Howells } s390_fp_regs;
2639807f759SDavid Howells 
2649807f759SDavid Howells #define FPC_EXCEPTION_MASK	0xF8000000
2659807f759SDavid Howells #define FPC_FLAGS_MASK		0x00F80000
2669807f759SDavid Howells #define FPC_DXC_MASK		0x0000FF00
2679807f759SDavid Howells #define FPC_RM_MASK		0x00000003
2689807f759SDavid Howells 
2699807f759SDavid Howells /* this typedef defines how a Program Status Word looks like */
27062e1dfa3SHendrik Brueckner typedef struct {
2719807f759SDavid Howells 	unsigned long mask;
2729807f759SDavid Howells 	unsigned long addr;
2739807f759SDavid Howells } __attribute__ ((aligned(8))) psw_t;
2749807f759SDavid Howells 
2759807f759SDavid Howells /*
2769807f759SDavid Howells  * The s390_regs structure is used to define the elf_gregset_t.
2779807f759SDavid Howells  */
27862e1dfa3SHendrik Brueckner typedef struct {
2799807f759SDavid Howells 	psw_t psw;
2809807f759SDavid Howells 	unsigned long gprs[NUM_GPRS];
2819807f759SDavid Howells 	unsigned int  acrs[NUM_ACRS];
2829807f759SDavid Howells 	unsigned long orig_gpr2;
2839807f759SDavid Howells } s390_regs;
2849807f759SDavid Howells 
2859807f759SDavid Howells /*
286466698e6SHendrik Brueckner  * The user_pt_regs structure exports the beginning of
287466698e6SHendrik Brueckner  * the in-kernel pt_regs structure to user space.
288466698e6SHendrik Brueckner  */
28962e1dfa3SHendrik Brueckner typedef struct {
290466698e6SHendrik Brueckner 	unsigned long args[1];
291466698e6SHendrik Brueckner 	psw_t psw;
292466698e6SHendrik Brueckner 	unsigned long gprs[NUM_GPRS];
293466698e6SHendrik Brueckner } user_pt_regs;
294466698e6SHendrik Brueckner 
295466698e6SHendrik Brueckner /*
2969807f759SDavid Howells  * Now for the user space program event recording (trace) definitions.
2979807f759SDavid Howells  * The following structures are used only for the ptrace interface, don't
2989807f759SDavid Howells  * touch or even look at it if you don't want to modify the user-space
2999807f759SDavid Howells  * ptrace interface. In particular stay away from it for in-kernel PER.
3009807f759SDavid Howells  */
30162e1dfa3SHendrik Brueckner typedef struct {
3029807f759SDavid Howells 	unsigned long cr[NUM_CR_WORDS];
3039807f759SDavid Howells } per_cr_words;
3049807f759SDavid Howells 
3059807f759SDavid Howells #define PER_EM_MASK 0xE8000000UL
3069807f759SDavid Howells 
30762e1dfa3SHendrik Brueckner typedef struct {
3089807f759SDavid Howells #ifdef __s390x__
3099807f759SDavid Howells 	unsigned		       : 32;
3109807f759SDavid Howells #endif /* __s390x__ */
3119807f759SDavid Howells 	unsigned em_branching	       : 1;
3129807f759SDavid Howells 	unsigned em_instruction_fetch  : 1;
3139807f759SDavid Howells 	/*
3149807f759SDavid Howells 	 * Switching on storage alteration automatically fixes
3159807f759SDavid Howells 	 * the storage alteration event bit in the users std.
3169807f759SDavid Howells 	 */
3179807f759SDavid Howells 	unsigned em_storage_alteration : 1;
3189807f759SDavid Howells 	unsigned em_gpr_alt_unused     : 1;
3199807f759SDavid Howells 	unsigned em_store_real_address : 1;
3209807f759SDavid Howells 	unsigned		       : 3;
3219807f759SDavid Howells 	unsigned branch_addr_ctl       : 1;
3229807f759SDavid Howells 	unsigned		       : 1;
3239807f759SDavid Howells 	unsigned storage_alt_space_ctl : 1;
3249807f759SDavid Howells 	unsigned		       : 21;
3259807f759SDavid Howells 	unsigned long starting_addr;
3269807f759SDavid Howells 	unsigned long ending_addr;
3279807f759SDavid Howells } per_cr_bits;
3289807f759SDavid Howells 
32962e1dfa3SHendrik Brueckner typedef struct {
3309807f759SDavid Howells 	unsigned short perc_atmid;
3319807f759SDavid Howells 	unsigned long address;
3329807f759SDavid Howells 	unsigned char access_id;
3339807f759SDavid Howells } per_lowcore_words;
3349807f759SDavid Howells 
33562e1dfa3SHendrik Brueckner typedef struct {
3369807f759SDavid Howells 	unsigned perc_branching		 : 1;
3379807f759SDavid Howells 	unsigned perc_instruction_fetch  : 1;
3389807f759SDavid Howells 	unsigned perc_storage_alteration : 1;
3399807f759SDavid Howells 	unsigned perc_gpr_alt_unused	 : 1;
3409807f759SDavid Howells 	unsigned perc_store_real_address : 1;
3419807f759SDavid Howells 	unsigned			 : 3;
3429807f759SDavid Howells 	unsigned atmid_psw_bit_31	 : 1;
3439807f759SDavid Howells 	unsigned atmid_validity_bit	 : 1;
3449807f759SDavid Howells 	unsigned atmid_psw_bit_32	 : 1;
3459807f759SDavid Howells 	unsigned atmid_psw_bit_5	 : 1;
3469807f759SDavid Howells 	unsigned atmid_psw_bit_16	 : 1;
3479807f759SDavid Howells 	unsigned atmid_psw_bit_17	 : 1;
3489807f759SDavid Howells 	unsigned si			 : 2;
3499807f759SDavid Howells 	unsigned long address;
3509807f759SDavid Howells 	unsigned			 : 4;
3519807f759SDavid Howells 	unsigned access_id		 : 4;
3529807f759SDavid Howells } per_lowcore_bits;
3539807f759SDavid Howells 
35462e1dfa3SHendrik Brueckner typedef struct {
3559807f759SDavid Howells 	union {
3569807f759SDavid Howells 		per_cr_words   words;
3579807f759SDavid Howells 		per_cr_bits    bits;
3589807f759SDavid Howells 	} control_regs;
3599807f759SDavid Howells 	/*
36025d539c9SMartin Schwidefsky 	 * The single_step and instruction_fetch bits are obsolete,
36125d539c9SMartin Schwidefsky 	 * the kernel always sets them to zero. To enable single
36225d539c9SMartin Schwidefsky 	 * stepping use ptrace(PTRACE_SINGLESTEP) instead.
3639807f759SDavid Howells 	 */
3649807f759SDavid Howells 	unsigned  single_step	    : 1;
3659807f759SDavid Howells 	unsigned  instruction_fetch : 1;
3669807f759SDavid Howells 	unsigned		    : 30;
3679807f759SDavid Howells 	/*
3689807f759SDavid Howells 	 * These addresses are copied into cr10 & cr11 if single
3699807f759SDavid Howells 	 * stepping is switched off
3709807f759SDavid Howells 	 */
3719807f759SDavid Howells 	unsigned long starting_addr;
3729807f759SDavid Howells 	unsigned long ending_addr;
3739807f759SDavid Howells 	union {
3749807f759SDavid Howells 		per_lowcore_words words;
3759807f759SDavid Howells 		per_lowcore_bits  bits;
3769807f759SDavid Howells 	} lowcore;
3779807f759SDavid Howells } per_struct;
3789807f759SDavid Howells 
37962e1dfa3SHendrik Brueckner typedef struct {
3809807f759SDavid Howells 	unsigned int  len;
3819807f759SDavid Howells 	unsigned long kernel_addr;
3829807f759SDavid Howells 	unsigned long process_addr;
3839807f759SDavid Howells } ptrace_area;
3849807f759SDavid Howells 
3859807f759SDavid Howells /*
3869807f759SDavid Howells  * S/390 specific non posix ptrace requests. I chose unusual values so
3879807f759SDavid Howells  * they are unlikely to clash with future ptrace definitions.
3889807f759SDavid Howells  */
3899807f759SDavid Howells #define PTRACE_PEEKUSR_AREA	      0x5000
3909807f759SDavid Howells #define PTRACE_POKEUSR_AREA	      0x5001
3919807f759SDavid Howells #define PTRACE_PEEKTEXT_AREA	      0x5002
3929807f759SDavid Howells #define PTRACE_PEEKDATA_AREA	      0x5003
3939807f759SDavid Howells #define PTRACE_POKETEXT_AREA	      0x5004
3949807f759SDavid Howells #define PTRACE_POKEDATA_AREA	      0x5005
3959807f759SDavid Howells #define PTRACE_GET_LAST_BREAK	      0x5006
3969807f759SDavid Howells #define PTRACE_PEEK_SYSTEM_CALL       0x5007
3979807f759SDavid Howells #define PTRACE_POKE_SYSTEM_CALL	      0x5008
3989807f759SDavid Howells #define PTRACE_ENABLE_TE	      0x5009
3999807f759SDavid Howells #define PTRACE_DISABLE_TE	      0x5010
40064597f9dSMichael Mueller #define PTRACE_TE_ABORT_RAND	      0x5011
4019807f759SDavid Howells 
4029807f759SDavid Howells /*
403818a330cSMartin Schwidefsky  * The numbers chosen here are somewhat arbitrary but absolutely MUST
404818a330cSMartin Schwidefsky  * not overlap with any of the number assigned in <linux/ptrace.h>.
405818a330cSMartin Schwidefsky  */
406818a330cSMartin Schwidefsky #define PTRACE_SINGLEBLOCK	12	/* resume execution until next branch */
407818a330cSMartin Schwidefsky 
408818a330cSMartin Schwidefsky /*
4099807f759SDavid Howells  * PT_PROT definition is loosely based on hppa bsd definition in
4109807f759SDavid Howells  * gdb/hppab-nat.c
4119807f759SDavid Howells  */
4129807f759SDavid Howells #define PTRACE_PROT			  21
4139807f759SDavid Howells 
41462e1dfa3SHendrik Brueckner typedef enum {
4159807f759SDavid Howells 	ptprot_set_access_watchpoint,
4169807f759SDavid Howells 	ptprot_set_write_watchpoint,
4179807f759SDavid Howells 	ptprot_disable_watchpoint
4189807f759SDavid Howells } ptprot_flags;
4199807f759SDavid Howells 
42062e1dfa3SHendrik Brueckner typedef struct {
4219807f759SDavid Howells 	unsigned long lowaddr;
4229807f759SDavid Howells 	unsigned long hiaddr;
4239807f759SDavid Howells 	ptprot_flags prot;
4249807f759SDavid Howells } ptprot_area;
4259807f759SDavid Howells 
4269807f759SDavid Howells /* Sequence of bytes for breakpoint illegal instruction.  */
4279807f759SDavid Howells #define S390_BREAKPOINT     {0x0,0x1}
4289807f759SDavid Howells #define S390_BREAKPOINT_U16 ((__u16)0x0001)
4299807f759SDavid Howells #define S390_SYSCALL_OPCODE ((__u16)0x0a00)
4309807f759SDavid Howells #define S390_SYSCALL_SIZE   2
4319807f759SDavid Howells 
4329807f759SDavid Howells /*
4339807f759SDavid Howells  * The user_regs_struct defines the way the user registers are
4349807f759SDavid Howells  * store on the stack for signal handling.
4359807f759SDavid Howells  */
43662e1dfa3SHendrik Brueckner struct user_regs_struct {
4379807f759SDavid Howells 	psw_t psw;
4389807f759SDavid Howells 	unsigned long gprs[NUM_GPRS];
4399807f759SDavid Howells 	unsigned int  acrs[NUM_ACRS];
4409807f759SDavid Howells 	unsigned long orig_gpr2;
4419807f759SDavid Howells 	s390_fp_regs fp_regs;
4429807f759SDavid Howells 	/*
4439807f759SDavid Howells 	 * These per registers are in here so that gdb can modify them
4449807f759SDavid Howells 	 * itself as there is no "official" ptrace interface for hardware
4459807f759SDavid Howells 	 * watchpoints. This is the way intel does it.
4469807f759SDavid Howells 	 */
4479807f759SDavid Howells 	per_struct per_info;
4489807f759SDavid Howells 	unsigned long ieee_instruction_pointer;	/* obsolete, always 0 */
4499807f759SDavid Howells };
4509807f759SDavid Howells 
4519807f759SDavid Howells #endif /* __ASSEMBLY__ */
4529807f759SDavid Howells 
4539807f759SDavid Howells #endif /* _UAPI_S390_PTRACE_H */
454