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