xref: /linux/arch/s390/include/uapi/asm/ptrace.h (revision 818a330c4e1be9c39fa7ca9221e044907d92b4bb)
19807f759SDavid Howells /*
29807f759SDavid Howells  *  S390 version
39807f759SDavid Howells  *    Copyright IBM Corp. 1999, 2000
49807f759SDavid Howells  *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
59807f759SDavid Howells  */
69807f759SDavid Howells 
79807f759SDavid Howells #ifndef _UAPI_S390_PTRACE_H
89807f759SDavid Howells #define _UAPI_S390_PTRACE_H
99807f759SDavid Howells 
109807f759SDavid Howells /*
119807f759SDavid Howells  * Offsets in the user_regs_struct. They are used for the ptrace
129807f759SDavid Howells  * system call and in entry.S
139807f759SDavid Howells  */
149807f759SDavid Howells #ifndef __s390x__
159807f759SDavid Howells 
169807f759SDavid Howells #define PT_PSWMASK  0x00
179807f759SDavid Howells #define PT_PSWADDR  0x04
189807f759SDavid Howells #define PT_GPR0     0x08
199807f759SDavid Howells #define PT_GPR1     0x0C
209807f759SDavid Howells #define PT_GPR2     0x10
219807f759SDavid Howells #define PT_GPR3     0x14
229807f759SDavid Howells #define PT_GPR4     0x18
239807f759SDavid Howells #define PT_GPR5     0x1C
249807f759SDavid Howells #define PT_GPR6     0x20
259807f759SDavid Howells #define PT_GPR7     0x24
269807f759SDavid Howells #define PT_GPR8     0x28
279807f759SDavid Howells #define PT_GPR9     0x2C
289807f759SDavid Howells #define PT_GPR10    0x30
299807f759SDavid Howells #define PT_GPR11    0x34
309807f759SDavid Howells #define PT_GPR12    0x38
319807f759SDavid Howells #define PT_GPR13    0x3C
329807f759SDavid Howells #define PT_GPR14    0x40
339807f759SDavid Howells #define PT_GPR15    0x44
349807f759SDavid Howells #define PT_ACR0     0x48
359807f759SDavid Howells #define PT_ACR1     0x4C
369807f759SDavid Howells #define PT_ACR2     0x50
379807f759SDavid Howells #define PT_ACR3     0x54
389807f759SDavid Howells #define PT_ACR4	    0x58
399807f759SDavid Howells #define PT_ACR5	    0x5C
409807f759SDavid Howells #define PT_ACR6	    0x60
419807f759SDavid Howells #define PT_ACR7	    0x64
429807f759SDavid Howells #define PT_ACR8	    0x68
439807f759SDavid Howells #define PT_ACR9	    0x6C
449807f759SDavid Howells #define PT_ACR10    0x70
459807f759SDavid Howells #define PT_ACR11    0x74
469807f759SDavid Howells #define PT_ACR12    0x78
479807f759SDavid Howells #define PT_ACR13    0x7C
489807f759SDavid Howells #define PT_ACR14    0x80
499807f759SDavid Howells #define PT_ACR15    0x84
509807f759SDavid Howells #define PT_ORIGGPR2 0x88
519807f759SDavid Howells #define PT_FPC	    0x90
529807f759SDavid Howells /*
539807f759SDavid Howells  * A nasty fact of life that the ptrace api
549807f759SDavid Howells  * only supports passing of longs.
559807f759SDavid Howells  */
569807f759SDavid Howells #define PT_FPR0_HI  0x98
579807f759SDavid Howells #define PT_FPR0_LO  0x9C
589807f759SDavid Howells #define PT_FPR1_HI  0xA0
599807f759SDavid Howells #define PT_FPR1_LO  0xA4
609807f759SDavid Howells #define PT_FPR2_HI  0xA8
619807f759SDavid Howells #define PT_FPR2_LO  0xAC
629807f759SDavid Howells #define PT_FPR3_HI  0xB0
639807f759SDavid Howells #define PT_FPR3_LO  0xB4
649807f759SDavid Howells #define PT_FPR4_HI  0xB8
659807f759SDavid Howells #define PT_FPR4_LO  0xBC
669807f759SDavid Howells #define PT_FPR5_HI  0xC0
679807f759SDavid Howells #define PT_FPR5_LO  0xC4
689807f759SDavid Howells #define PT_FPR6_HI  0xC8
699807f759SDavid Howells #define PT_FPR6_LO  0xCC
709807f759SDavid Howells #define PT_FPR7_HI  0xD0
719807f759SDavid Howells #define PT_FPR7_LO  0xD4
729807f759SDavid Howells #define PT_FPR8_HI  0xD8
739807f759SDavid Howells #define PT_FPR8_LO  0XDC
749807f759SDavid Howells #define PT_FPR9_HI  0xE0
759807f759SDavid Howells #define PT_FPR9_LO  0xE4
769807f759SDavid Howells #define PT_FPR10_HI 0xE8
779807f759SDavid Howells #define PT_FPR10_LO 0xEC
789807f759SDavid Howells #define PT_FPR11_HI 0xF0
799807f759SDavid Howells #define PT_FPR11_LO 0xF4
809807f759SDavid Howells #define PT_FPR12_HI 0xF8
819807f759SDavid Howells #define PT_FPR12_LO 0xFC
829807f759SDavid Howells #define PT_FPR13_HI 0x100
839807f759SDavid Howells #define PT_FPR13_LO 0x104
849807f759SDavid Howells #define PT_FPR14_HI 0x108
859807f759SDavid Howells #define PT_FPR14_LO 0x10C
869807f759SDavid Howells #define PT_FPR15_HI 0x110
879807f759SDavid Howells #define PT_FPR15_LO 0x114
889807f759SDavid Howells #define PT_CR_9	    0x118
899807f759SDavid Howells #define PT_CR_10    0x11C
909807f759SDavid Howells #define PT_CR_11    0x120
919807f759SDavid Howells #define PT_IEEE_IP  0x13C
929807f759SDavid Howells #define PT_LASTOFF  PT_IEEE_IP
939807f759SDavid Howells #define PT_ENDREGS  0x140-1
949807f759SDavid Howells 
959807f759SDavid Howells #define GPR_SIZE	4
969807f759SDavid Howells #define CR_SIZE		4
979807f759SDavid Howells 
989807f759SDavid Howells #define STACK_FRAME_OVERHEAD	96	/* size of minimum stack frame */
999807f759SDavid Howells 
1009807f759SDavid Howells #else /* __s390x__ */
1019807f759SDavid Howells 
1029807f759SDavid Howells #define PT_PSWMASK  0x00
1039807f759SDavid Howells #define PT_PSWADDR  0x08
1049807f759SDavid Howells #define PT_GPR0     0x10
1059807f759SDavid Howells #define PT_GPR1     0x18
1069807f759SDavid Howells #define PT_GPR2     0x20
1079807f759SDavid Howells #define PT_GPR3     0x28
1089807f759SDavid Howells #define PT_GPR4     0x30
1099807f759SDavid Howells #define PT_GPR5     0x38
1109807f759SDavid Howells #define PT_GPR6     0x40
1119807f759SDavid Howells #define PT_GPR7     0x48
1129807f759SDavid Howells #define PT_GPR8     0x50
1139807f759SDavid Howells #define PT_GPR9     0x58
1149807f759SDavid Howells #define PT_GPR10    0x60
1159807f759SDavid Howells #define PT_GPR11    0x68
1169807f759SDavid Howells #define PT_GPR12    0x70
1179807f759SDavid Howells #define PT_GPR13    0x78
1189807f759SDavid Howells #define PT_GPR14    0x80
1199807f759SDavid Howells #define PT_GPR15    0x88
1209807f759SDavid Howells #define PT_ACR0     0x90
1219807f759SDavid Howells #define PT_ACR1     0x94
1229807f759SDavid Howells #define PT_ACR2     0x98
1239807f759SDavid Howells #define PT_ACR3     0x9C
1249807f759SDavid Howells #define PT_ACR4	    0xA0
1259807f759SDavid Howells #define PT_ACR5	    0xA4
1269807f759SDavid Howells #define PT_ACR6	    0xA8
1279807f759SDavid Howells #define PT_ACR7	    0xAC
1289807f759SDavid Howells #define PT_ACR8	    0xB0
1299807f759SDavid Howells #define PT_ACR9	    0xB4
1309807f759SDavid Howells #define PT_ACR10    0xB8
1319807f759SDavid Howells #define PT_ACR11    0xBC
1329807f759SDavid Howells #define PT_ACR12    0xC0
1339807f759SDavid Howells #define PT_ACR13    0xC4
1349807f759SDavid Howells #define PT_ACR14    0xC8
1359807f759SDavid Howells #define PT_ACR15    0xCC
1369807f759SDavid Howells #define PT_ORIGGPR2 0xD0
1379807f759SDavid Howells #define PT_FPC	    0xD8
1389807f759SDavid Howells #define PT_FPR0     0xE0
1399807f759SDavid Howells #define PT_FPR1     0xE8
1409807f759SDavid Howells #define PT_FPR2     0xF0
1419807f759SDavid Howells #define PT_FPR3     0xF8
1429807f759SDavid Howells #define PT_FPR4     0x100
1439807f759SDavid Howells #define PT_FPR5     0x108
1449807f759SDavid Howells #define PT_FPR6     0x110
1459807f759SDavid Howells #define PT_FPR7     0x118
1469807f759SDavid Howells #define PT_FPR8     0x120
1479807f759SDavid Howells #define PT_FPR9     0x128
1489807f759SDavid Howells #define PT_FPR10    0x130
1499807f759SDavid Howells #define PT_FPR11    0x138
1509807f759SDavid Howells #define PT_FPR12    0x140
1519807f759SDavid Howells #define PT_FPR13    0x148
1529807f759SDavid Howells #define PT_FPR14    0x150
1539807f759SDavid Howells #define PT_FPR15    0x158
1549807f759SDavid Howells #define PT_CR_9     0x160
1559807f759SDavid Howells #define PT_CR_10    0x168
1569807f759SDavid Howells #define PT_CR_11    0x170
1579807f759SDavid Howells #define PT_IEEE_IP  0x1A8
1589807f759SDavid Howells #define PT_LASTOFF  PT_IEEE_IP
1599807f759SDavid Howells #define PT_ENDREGS  0x1B0-1
1609807f759SDavid Howells 
1619807f759SDavid Howells #define GPR_SIZE	8
1629807f759SDavid Howells #define CR_SIZE		8
1639807f759SDavid Howells 
1649807f759SDavid Howells #define STACK_FRAME_OVERHEAD    160      /* size of minimum stack frame */
1659807f759SDavid Howells 
1669807f759SDavid Howells #endif /* __s390x__ */
1679807f759SDavid Howells 
1689807f759SDavid Howells #define NUM_GPRS	16
1699807f759SDavid Howells #define NUM_FPRS	16
1709807f759SDavid Howells #define NUM_CRS		16
1719807f759SDavid Howells #define NUM_ACRS	16
1729807f759SDavid Howells 
1739807f759SDavid Howells #define NUM_CR_WORDS	3
1749807f759SDavid Howells 
1759807f759SDavid Howells #define FPR_SIZE	8
1769807f759SDavid Howells #define FPC_SIZE	4
1779807f759SDavid Howells #define FPC_PAD_SIZE	4 /* gcc insists on aligning the fpregs */
1789807f759SDavid Howells #define ACR_SIZE	4
1799807f759SDavid Howells 
1809807f759SDavid Howells 
1819807f759SDavid Howells #define PTRACE_OLDSETOPTIONS         21
1829807f759SDavid Howells 
1839807f759SDavid Howells #ifndef __ASSEMBLY__
1849807f759SDavid Howells #include <linux/stddef.h>
1859807f759SDavid Howells #include <linux/types.h>
1869807f759SDavid Howells 
1879807f759SDavid Howells typedef union
1889807f759SDavid Howells {
1899807f759SDavid Howells 	float   f;
1909807f759SDavid Howells 	double  d;
1919807f759SDavid Howells         __u64   ui;
1929807f759SDavid Howells 	struct
1939807f759SDavid Howells 	{
1949807f759SDavid Howells 		__u32 hi;
1959807f759SDavid Howells 		__u32 lo;
1969807f759SDavid Howells 	} fp;
1979807f759SDavid Howells } freg_t;
1989807f759SDavid Howells 
1999807f759SDavid Howells typedef struct
2009807f759SDavid Howells {
2019807f759SDavid Howells 	__u32   fpc;
2024725c860SMartin Schwidefsky 	__u32	pad;
2039807f759SDavid Howells 	freg_t  fprs[NUM_FPRS];
2049807f759SDavid Howells } s390_fp_regs;
2059807f759SDavid Howells 
2069807f759SDavid Howells #define FPC_EXCEPTION_MASK      0xF8000000
2079807f759SDavid Howells #define FPC_FLAGS_MASK          0x00F80000
2089807f759SDavid Howells #define FPC_DXC_MASK            0x0000FF00
2099807f759SDavid Howells #define FPC_RM_MASK             0x00000003
2109807f759SDavid Howells 
2119807f759SDavid Howells /* this typedef defines how a Program Status Word looks like */
2129807f759SDavid Howells typedef struct
2139807f759SDavid Howells {
2149807f759SDavid Howells         unsigned long mask;
2159807f759SDavid Howells         unsigned long addr;
2169807f759SDavid Howells } __attribute__ ((aligned(8))) psw_t;
2179807f759SDavid Howells 
2189807f759SDavid Howells #ifndef __s390x__
2199807f759SDavid Howells 
2209807f759SDavid Howells #define PSW_MASK_PER		0x40000000UL
2219807f759SDavid Howells #define PSW_MASK_DAT		0x04000000UL
2229807f759SDavid Howells #define PSW_MASK_IO		0x02000000UL
2239807f759SDavid Howells #define PSW_MASK_EXT		0x01000000UL
2249807f759SDavid Howells #define PSW_MASK_KEY		0x00F00000UL
2259807f759SDavid Howells #define PSW_MASK_BASE		0x00080000UL	/* always one */
2269807f759SDavid Howells #define PSW_MASK_MCHECK		0x00040000UL
2279807f759SDavid Howells #define PSW_MASK_WAIT		0x00020000UL
2289807f759SDavid Howells #define PSW_MASK_PSTATE		0x00010000UL
2299807f759SDavid Howells #define PSW_MASK_ASC		0x0000C000UL
2309807f759SDavid Howells #define PSW_MASK_CC		0x00003000UL
2319807f759SDavid Howells #define PSW_MASK_PM		0x00000F00UL
2329807f759SDavid Howells #define PSW_MASK_RI		0x00000000UL
2339807f759SDavid Howells #define PSW_MASK_EA		0x00000000UL
2349807f759SDavid Howells #define PSW_MASK_BA		0x00000000UL
2359807f759SDavid Howells 
236fa968ee2SMartin Schwidefsky #define PSW_MASK_USER		0x0000FF00UL
2379807f759SDavid Howells 
2389807f759SDavid Howells #define PSW_ADDR_AMODE		0x80000000UL
2399807f759SDavid Howells #define PSW_ADDR_INSN		0x7FFFFFFFUL
2409807f759SDavid Howells 
2419807f759SDavid Howells #define PSW_DEFAULT_KEY		(((unsigned long) PAGE_DEFAULT_ACC) << 20)
2429807f759SDavid Howells 
2439807f759SDavid Howells #define PSW_ASC_PRIMARY		0x00000000UL
2449807f759SDavid Howells #define PSW_ASC_ACCREG		0x00004000UL
2459807f759SDavid Howells #define PSW_ASC_SECONDARY	0x00008000UL
2469807f759SDavid Howells #define PSW_ASC_HOME		0x0000C000UL
2479807f759SDavid Howells 
2489807f759SDavid Howells #else /* __s390x__ */
2499807f759SDavid Howells 
2509807f759SDavid Howells #define PSW_MASK_PER		0x4000000000000000UL
2519807f759SDavid Howells #define PSW_MASK_DAT		0x0400000000000000UL
2529807f759SDavid Howells #define PSW_MASK_IO		0x0200000000000000UL
2539807f759SDavid Howells #define PSW_MASK_EXT		0x0100000000000000UL
2549807f759SDavid Howells #define PSW_MASK_BASE		0x0000000000000000UL
2559807f759SDavid Howells #define PSW_MASK_KEY		0x00F0000000000000UL
2569807f759SDavid Howells #define PSW_MASK_MCHECK		0x0004000000000000UL
2579807f759SDavid Howells #define PSW_MASK_WAIT		0x0002000000000000UL
2589807f759SDavid Howells #define PSW_MASK_PSTATE		0x0001000000000000UL
2599807f759SDavid Howells #define PSW_MASK_ASC		0x0000C00000000000UL
2609807f759SDavid Howells #define PSW_MASK_CC		0x0000300000000000UL
2619807f759SDavid Howells #define PSW_MASK_PM		0x00000F0000000000UL
2629807f759SDavid Howells #define PSW_MASK_RI		0x0000008000000000UL
2639807f759SDavid Howells #define PSW_MASK_EA		0x0000000100000000UL
2649807f759SDavid Howells #define PSW_MASK_BA		0x0000000080000000UL
2659807f759SDavid Howells 
2665ebf250dSHeiko Carstens #define PSW_MASK_USER		0x0000FF0180000000UL
2679807f759SDavid Howells 
2689807f759SDavid Howells #define PSW_ADDR_AMODE		0x0000000000000000UL
2699807f759SDavid Howells #define PSW_ADDR_INSN		0xFFFFFFFFFFFFFFFFUL
2709807f759SDavid Howells 
2719807f759SDavid Howells #define PSW_DEFAULT_KEY		(((unsigned long) PAGE_DEFAULT_ACC) << 52)
2729807f759SDavid Howells 
2739807f759SDavid Howells #define PSW_ASC_PRIMARY		0x0000000000000000UL
2749807f759SDavid Howells #define PSW_ASC_ACCREG		0x0000400000000000UL
2759807f759SDavid Howells #define PSW_ASC_SECONDARY	0x0000800000000000UL
2769807f759SDavid Howells #define PSW_ASC_HOME		0x0000C00000000000UL
2779807f759SDavid Howells 
2789807f759SDavid Howells #endif /* __s390x__ */
2799807f759SDavid Howells 
2809807f759SDavid Howells 
2819807f759SDavid Howells /*
2829807f759SDavid Howells  * The s390_regs structure is used to define the elf_gregset_t.
2839807f759SDavid Howells  */
2849807f759SDavid Howells typedef struct
2859807f759SDavid Howells {
2869807f759SDavid Howells 	psw_t psw;
2879807f759SDavid Howells 	unsigned long gprs[NUM_GPRS];
2889807f759SDavid Howells 	unsigned int  acrs[NUM_ACRS];
2899807f759SDavid Howells 	unsigned long orig_gpr2;
2909807f759SDavid Howells } s390_regs;
2919807f759SDavid Howells 
2929807f759SDavid Howells /*
2939807f759SDavid Howells  * Now for the user space program event recording (trace) definitions.
2949807f759SDavid Howells  * The following structures are used only for the ptrace interface, don't
2959807f759SDavid Howells  * touch or even look at it if you don't want to modify the user-space
2969807f759SDavid Howells  * ptrace interface. In particular stay away from it for in-kernel PER.
2979807f759SDavid Howells  */
2989807f759SDavid Howells typedef struct
2999807f759SDavid Howells {
3009807f759SDavid Howells 	unsigned long cr[NUM_CR_WORDS];
3019807f759SDavid Howells } per_cr_words;
3029807f759SDavid Howells 
3039807f759SDavid Howells #define PER_EM_MASK 0xE8000000UL
3049807f759SDavid Howells 
3059807f759SDavid Howells typedef	struct
3069807f759SDavid Howells {
3079807f759SDavid Howells #ifdef __s390x__
3089807f759SDavid Howells 	unsigned                       : 32;
3099807f759SDavid Howells #endif /* __s390x__ */
3109807f759SDavid Howells 	unsigned em_branching          : 1;
3119807f759SDavid Howells 	unsigned em_instruction_fetch  : 1;
3129807f759SDavid Howells 	/*
3139807f759SDavid Howells 	 * Switching on storage alteration automatically fixes
3149807f759SDavid Howells 	 * the storage alteration event bit in the users std.
3159807f759SDavid Howells 	 */
3169807f759SDavid Howells 	unsigned em_storage_alteration : 1;
3179807f759SDavid Howells 	unsigned em_gpr_alt_unused     : 1;
3189807f759SDavid Howells 	unsigned em_store_real_address : 1;
3199807f759SDavid Howells 	unsigned                       : 3;
3209807f759SDavid Howells 	unsigned branch_addr_ctl       : 1;
3219807f759SDavid Howells 	unsigned                       : 1;
3229807f759SDavid Howells 	unsigned storage_alt_space_ctl : 1;
3239807f759SDavid Howells 	unsigned                       : 21;
3249807f759SDavid Howells 	unsigned long starting_addr;
3259807f759SDavid Howells 	unsigned long ending_addr;
3269807f759SDavid Howells } per_cr_bits;
3279807f759SDavid Howells 
3289807f759SDavid Howells typedef struct
3299807f759SDavid Howells {
3309807f759SDavid Howells 	unsigned short perc_atmid;
3319807f759SDavid Howells 	unsigned long address;
3329807f759SDavid Howells 	unsigned char access_id;
3339807f759SDavid Howells } per_lowcore_words;
3349807f759SDavid Howells 
3359807f759SDavid Howells typedef struct
3369807f759SDavid Howells {
3379807f759SDavid Howells 	unsigned perc_branching          : 1;
3389807f759SDavid Howells 	unsigned perc_instruction_fetch  : 1;
3399807f759SDavid Howells 	unsigned perc_storage_alteration : 1;
3409807f759SDavid Howells 	unsigned perc_gpr_alt_unused     : 1;
3419807f759SDavid Howells 	unsigned perc_store_real_address : 1;
3429807f759SDavid Howells 	unsigned                         : 3;
3439807f759SDavid Howells 	unsigned atmid_psw_bit_31        : 1;
3449807f759SDavid Howells 	unsigned atmid_validity_bit      : 1;
3459807f759SDavid Howells 	unsigned atmid_psw_bit_32        : 1;
3469807f759SDavid Howells 	unsigned atmid_psw_bit_5         : 1;
3479807f759SDavid Howells 	unsigned atmid_psw_bit_16        : 1;
3489807f759SDavid Howells 	unsigned atmid_psw_bit_17        : 1;
3499807f759SDavid Howells 	unsigned si                      : 2;
3509807f759SDavid Howells 	unsigned long address;
3519807f759SDavid Howells 	unsigned                         : 4;
3529807f759SDavid Howells 	unsigned access_id               : 4;
3539807f759SDavid Howells } per_lowcore_bits;
3549807f759SDavid Howells 
3559807f759SDavid Howells typedef struct
3569807f759SDavid Howells {
3579807f759SDavid Howells 	union {
3589807f759SDavid Howells 		per_cr_words   words;
3599807f759SDavid Howells 		per_cr_bits    bits;
3609807f759SDavid Howells 	} control_regs;
3619807f759SDavid Howells 	/*
3629807f759SDavid Howells 	 * Use these flags instead of setting em_instruction_fetch
3639807f759SDavid Howells 	 * directly they are used so that single stepping can be
3649807f759SDavid Howells 	 * switched on & off while not affecting other tracing
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 
3819807f759SDavid Howells typedef struct
3829807f759SDavid Howells {
3839807f759SDavid Howells 	unsigned int  len;
3849807f759SDavid Howells 	unsigned long kernel_addr;
3859807f759SDavid Howells 	unsigned long process_addr;
3869807f759SDavid Howells } ptrace_area;
3879807f759SDavid Howells 
3889807f759SDavid Howells /*
3899807f759SDavid Howells  * S/390 specific non posix ptrace requests. I chose unusual values so
3909807f759SDavid Howells  * they are unlikely to clash with future ptrace definitions.
3919807f759SDavid Howells  */
3929807f759SDavid Howells #define PTRACE_PEEKUSR_AREA           0x5000
3939807f759SDavid Howells #define PTRACE_POKEUSR_AREA           0x5001
3949807f759SDavid Howells #define PTRACE_PEEKTEXT_AREA	      0x5002
3959807f759SDavid Howells #define PTRACE_PEEKDATA_AREA	      0x5003
3969807f759SDavid Howells #define PTRACE_POKETEXT_AREA	      0x5004
3979807f759SDavid Howells #define PTRACE_POKEDATA_AREA 	      0x5005
3989807f759SDavid Howells #define PTRACE_GET_LAST_BREAK	      0x5006
3999807f759SDavid Howells #define PTRACE_PEEK_SYSTEM_CALL       0x5007
4009807f759SDavid Howells #define PTRACE_POKE_SYSTEM_CALL	      0x5008
4019807f759SDavid Howells #define PTRACE_ENABLE_TE	      0x5009
4029807f759SDavid Howells #define PTRACE_DISABLE_TE	      0x5010
40364597f9dSMichael Mueller #define PTRACE_TE_ABORT_RAND	      0x5011
4049807f759SDavid Howells 
4059807f759SDavid Howells /*
406*818a330cSMartin Schwidefsky  * The numbers chosen here are somewhat arbitrary but absolutely MUST
407*818a330cSMartin Schwidefsky  * not overlap with any of the number assigned in <linux/ptrace.h>.
408*818a330cSMartin Schwidefsky  */
409*818a330cSMartin Schwidefsky #define PTRACE_SINGLEBLOCK	12	/* resume execution until next branch */
410*818a330cSMartin Schwidefsky 
411*818a330cSMartin Schwidefsky /*
4129807f759SDavid Howells  * PT_PROT definition is loosely based on hppa bsd definition in
4139807f759SDavid Howells  * gdb/hppab-nat.c
4149807f759SDavid Howells  */
4159807f759SDavid Howells #define PTRACE_PROT                       21
4169807f759SDavid Howells 
4179807f759SDavid Howells typedef enum
4189807f759SDavid Howells {
4199807f759SDavid Howells 	ptprot_set_access_watchpoint,
4209807f759SDavid Howells 	ptprot_set_write_watchpoint,
4219807f759SDavid Howells 	ptprot_disable_watchpoint
4229807f759SDavid Howells } ptprot_flags;
4239807f759SDavid Howells 
4249807f759SDavid Howells typedef struct
4259807f759SDavid Howells {
4269807f759SDavid Howells 	unsigned long lowaddr;
4279807f759SDavid Howells 	unsigned long hiaddr;
4289807f759SDavid Howells 	ptprot_flags prot;
4299807f759SDavid Howells } ptprot_area;
4309807f759SDavid Howells 
4319807f759SDavid Howells /* Sequence of bytes for breakpoint illegal instruction.  */
4329807f759SDavid Howells #define S390_BREAKPOINT     {0x0,0x1}
4339807f759SDavid Howells #define S390_BREAKPOINT_U16 ((__u16)0x0001)
4349807f759SDavid Howells #define S390_SYSCALL_OPCODE ((__u16)0x0a00)
4359807f759SDavid Howells #define S390_SYSCALL_SIZE   2
4369807f759SDavid Howells 
4379807f759SDavid Howells /*
4389807f759SDavid Howells  * The user_regs_struct defines the way the user registers are
4399807f759SDavid Howells  * store on the stack for signal handling.
4409807f759SDavid Howells  */
4419807f759SDavid Howells struct user_regs_struct
4429807f759SDavid Howells {
4439807f759SDavid Howells 	psw_t psw;
4449807f759SDavid Howells 	unsigned long gprs[NUM_GPRS];
4459807f759SDavid Howells 	unsigned int  acrs[NUM_ACRS];
4469807f759SDavid Howells 	unsigned long orig_gpr2;
4479807f759SDavid Howells 	s390_fp_regs fp_regs;
4489807f759SDavid Howells 	/*
4499807f759SDavid Howells 	 * These per registers are in here so that gdb can modify them
4509807f759SDavid Howells 	 * itself as there is no "official" ptrace interface for hardware
4519807f759SDavid Howells 	 * watchpoints. This is the way intel does it.
4529807f759SDavid Howells 	 */
4539807f759SDavid Howells 	per_struct per_info;
4549807f759SDavid Howells 	unsigned long ieee_instruction_pointer;	/* obsolete, always 0 */
4559807f759SDavid Howells };
4569807f759SDavid Howells 
4579807f759SDavid Howells #endif /* __ASSEMBLY__ */
4589807f759SDavid Howells 
4599807f759SDavid Howells #endif /* _UAPI_S390_PTRACE_H */
460