2 * include/asm-s390/ptrace.h
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
10 #define _S390_PTRACE_H
13 * Offsets in the user_regs_struct. They are used for the ptrace
14 * system call and in entry.S
16 #define PT_PSWMASK 0x00
17 #define PT_PSWADDR 0x08
50 #define PT_ORIGGPR2 0xD0
62 #define PT_FPR10 0x130
63 #define PT_FPR11 0x138
64 #define PT_FPR12 0x140
65 #define PT_FPR13 0x148
66 #define PT_FPR14 0x150
67 #define PT_FPR15 0x158
69 #define PT_CR_10 0x168
70 #define PT_CR_11 0x170
71 #define PT_IEEE_IP 0x1A8
72 #define PT_LASTOFF PT_IEEE_IP
73 #define PT_ENDREGS 0x1B0-1
82 #define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
86 #define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
89 #include <linux/config.h>
90 #include <linux/stddef.h>
91 #include <linux/types.h>
93 #include <asm/current.h>
94 #include <asm/setup.h>
96 /* this typedef defines how a Program Status Word looks like */
101 } __attribute__ ((aligned(8))) psw_t;
104 #define FIX_PSW(addr) ((unsigned long)(addr))
105 #define ADDR_BITS_REMOVE(addr) ((addr))
123 freg_t fprs[NUM_FPRS];
126 #define FPC_EXCEPTION_MASK 0xF8000000
127 #define FPC_FLAGS_MASK 0x00F80000
128 #define FPC_DXC_MASK 0x0000FF00
129 #define FPC_RM_MASK 0x00000003
130 #define FPC_VALID_MASK 0xF8F8FF03
133 * The first entries in pt_regs and user_regs_struct
134 * are common for the two structures. The s390_regs structure
135 * covers the common parts. It simplifies copying the common part
136 * between the three structures.
141 __u64 gprs[NUM_GPRS];
142 __u32 acrs[NUM_ACRS];
147 * The pt_regs struct defines the way the registers are stored on
148 * the stack during a system call.
153 __u64 gprs[NUM_GPRS];
154 __u32 acrs[NUM_ACRS];
157 } __attribute__ ((packed));
160 * Now for the program event recording (trace) definitions.
167 #define PER_EM_MASK 0x00000000E8000000UL
172 unsigned em_branching : 1;
173 unsigned em_instruction_fetch : 1;
175 * Switching on storage alteration automatically fixes
176 * the storage alteration event bit in the users std.
178 unsigned em_storage_alteration : 1;
179 unsigned em_gpr_alt_unused : 1;
180 unsigned em_store_real_address : 1;
182 unsigned branch_addr_ctl : 1;
184 unsigned storage_alt_space_ctl : 1;
186 addr_t starting_addr;
199 unsigned perc_branching : 1; /* 0x096 */
200 unsigned perc_instruction_fetch : 1;
201 unsigned perc_storage_alteration : 1;
202 unsigned perc_gpr_alt_unused : 1;
203 unsigned perc_store_real_address : 1;
205 unsigned atmid_psw_bit_31 : 1;
206 unsigned atmid_validity_bit : 1;
207 unsigned atmid_psw_bit_32 : 1;
208 unsigned atmid_psw_bit_5 : 1;
209 unsigned atmid_psw_bit_16 : 1;
210 unsigned atmid_psw_bit_17 : 1;
212 addr_t address; /* 0x098 */
213 unsigned : 4; /* 0x0a1 */
214 unsigned access_id : 4;
224 * Use these flags instead of setting em_instruction_fetch
225 * directly they are used so that single stepping can be
226 * switched on & off while not affecting other tracing
228 unsigned single_step : 1;
229 unsigned instruction_fetch : 1;
232 * These addresses are copied into cr10 & cr11 if single
233 * stepping is switched off
235 addr_t starting_addr;
238 per_lowcore_words words;
239 per_lowcore_bits bits;
251 * S/390 specific non posix ptrace requests. I chose unusual values so
252 * they are unlikely to clash with future ptrace definitions.
254 #define PTRACE_PEEKUSR_AREA 0x5000
255 #define PTRACE_POKEUSR_AREA 0x5001
256 #define PTRACE_PEEKTEXT_AREA 0x5002
257 #define PTRACE_PEEKDATA_AREA 0x5003
258 #define PTRACE_POKETEXT_AREA 0x5004
259 #define PTRACE_POKEDATA_AREA 0x5005
261 * PT_PROT definition is loosely based on hppa bsd definition in
264 #define PTRACE_PROT 21
268 ptprot_set_access_watchpoint,
269 ptprot_set_write_watchpoint,
270 ptprot_disable_watchpoint
280 /* Sequence of bytes for breakpoint illegal instruction. */
281 #define S390_BREAKPOINT {0x0,0x1}
282 #define S390_BREAKPOINT_U16 ((__u16)0x0001)
283 #define S390_SYSCALL_OPCODE ((__u16)0x0a00)
284 #define S390_SYSCALL_SIZE 2
287 * The user_regs_struct defines the way the user registers are
288 * store on the stack for signal handling.
290 struct user_regs_struct
293 __u64 gprs[NUM_GPRS];
294 __u32 acrs[NUM_ACRS];
296 s390_fp_regs fp_regs;
298 * These per registers are in here so that gdb can modify them
299 * itself as there is no "official" ptrace interface for hardware
300 * watchpoints. This is the way intel does it.
303 addr_t ieee_instruction_pointer;
304 /* Used to give failing instruction back to user for ieee exceptions */
308 #define user_mode(regs) (((regs)->psw.mask & PSW_PROBLEM_STATE) != 0)
309 #define instruction_pointer(regs) ((regs)->psw.addr)
310 extern void show_regs(struct pt_regs * regs);
311 extern char *task_show_regs(struct task_struct *task, char *buffer);
314 #endif /* __ASSEMBLY__ */
316 #endif /* _S390X_PTRACE_H */