2 * include/asm-s390/ptrace.h
5 * Copyright (C) 1999,2000 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
11 #include <linux/config.h>
12 #include <asm/s390-regs-common.h>
13 #include <asm/current.h>
14 #include <linux/types.h>
15 #include <asm/setup.h>
16 #include <linux/stddef.h>
34 #if CONFIG_REMOTE_DEBUG
48 } per_cr_words
__attribute__((packed
));
50 #define PER_EM_MASK 0xE8000000
53 unsigned em_branching
:1;
54 unsigned em_instruction_fetch
:1;
55 /* Switching on storage alteration automatically fixes
56 the storage alteration event bit in the users std. */
57 unsigned em_storage_alteration
:1;
58 unsigned em_gpr_alt_unused
:1;
59 unsigned em_store_real_address
:1;
61 unsigned branch_addr_ctl
:1;
63 unsigned storage_alt_space_ctl
:1;
68 } per_cr_bits
__attribute__((packed
));
72 __u16 perc_atmid
; /* 0x096 */
73 __u32 address
; /* 0x098 */
74 __u8 access_id
; /* 0x0a1 */
75 } per_lowcore_words
__attribute__((packed
));
79 unsigned perc_branching
:1; /* 0x096 */
80 unsigned perc_instruction_fetch
:1;
81 unsigned perc_storage_alteration
:1;
82 unsigned perc_gpr_alt_unused
:1;
83 unsigned perc_store_real_address
:1;
88 __u32 address
; /* 0x098 */
89 unsigned :4; /* 0x0a1 */
91 } per_lowcore_bits
__attribute__((packed
));
99 } control_regs
__attribute__((packed
));
100 /* Use these flags instead of setting em_instruction_fetch */
101 /* directly they are used so that single stepping can be */
102 /* switched on & off while not affecting other tracing */
103 unsigned single_step
:1;
104 unsigned instruction_fetch
:1;
106 /* These addresses are copied into cr10 & cr11 if single stepping
112 per_lowcore_words words
;
113 per_lowcore_bits bits
;
115 } per_struct
__attribute__((packed
));
119 /* this struct defines the way the registers are stored on the
120 stack during a system call. If you change the pt_regs structure,
121 you'll need to change user.h too.
123 N.B. if you modify the pt_regs struct the strace command also has to be
124 modified & recompiled ( just wait till we have gdb going ).
128 struct user_regs_struct
131 s390_fp_regs fp_regs
;
132 /* These per registers are in here so that gdb can modify them itself
133 * as there is no "official" ptrace interface for hardware watchpoints.
134 * this is the way intel does it
139 typedef struct user_regs_struct user_regs_struct
;
141 typedef struct pt_regs pt_regs
;
144 #define user_mode(regs) (((regs)->psw.mask & PSW_PROBLEM_STATE) != 0)
145 #define instruction_pointer(regs) ((regs)->psw.addr)
147 struct thread_struct
;
148 extern int sprintf_regs(int line
,char *buff
,struct task_struct
* task
,
149 struct thread_struct
*tss
,struct pt_regs
* regs
);
150 extern void show_regs(struct task_struct
* task
,struct thread_struct
*tss
,
151 struct pt_regs
* regs
);
158 #define FIX_PSW(addr) ((unsigned long)(addr)|0x80000000UL)
160 #define MULT_PROCPTR_TYPES ((CONFIG_BINFMT_ELF)&&(CONFIG_BINFMT_TOC))
166 } routine_descriptor
;
167 extern void fix_routine_descriptor_regs(routine_descriptor
*rdes
,pt_regs
*regs
);
168 extern __inline__
void
169 fix_routine_descriptor_regs(routine_descriptor
*rdes
,pt_regs
*regs
)
171 regs
->psw
.addr
=FIX_PSW(rdes
->addr
);
172 regs
->gprs
[12]=rdes
->toc
;
176 * Compiler optimisation should save this stuff from being non optimal
177 * & remove uneccessary code ( isnt gcc great DJB. )
180 /*I'm just using this an indicator of what binformat we are using
181 * (DJB) N.B. this needs to stay a macro unfortunately as I am otherwise
182 * dereferencing incomplete pointer types in with load_toc_binary
184 #if MULT_PROCPTR_TYPES
185 #define uses_routine_descriptors() \
186 (current->binfmt->load_binary==load_toc_binary)
188 #if CONFIG_BINFMT_TOC
189 #define uses_routine_descriptors() 1
191 #define uses_routine_descriptors() 0
195 #define pt_off(ptreg) offsetof(user_regs_struct,ptreg)
198 PT_PSWMASK
=pt_off(psw
.mask
),
199 PT_PSWADDR
=pt_off(psw
.addr
),
200 PT_GPR0
=pt_off(gprs
[0]),
201 PT_GPR1
=pt_off(gprs
[1]),
202 PT_GPR2
=pt_off(gprs
[2]),
203 PT_GPR3
=pt_off(gprs
[3]),
204 PT_GPR4
=pt_off(gprs
[4]),
205 PT_GPR5
=pt_off(gprs
[5]),
206 PT_GPR6
=pt_off(gprs
[6]),
207 PT_GPR7
=pt_off(gprs
[7]),
208 PT_GPR8
=pt_off(gprs
[8]),
209 PT_GPR9
=pt_off(gprs
[9]),
210 PT_GPR10
=pt_off(gprs
[10]),
211 PT_GPR11
=pt_off(gprs
[11]),
212 PT_GPR12
=pt_off(gprs
[12]),
213 PT_GPR13
=pt_off(gprs
[13]),
214 PT_GPR14
=pt_off(gprs
[14]),
215 PT_GPR15
=pt_off(gprs
[15]),
216 PT_ACR0
=pt_off(acrs
[0]),
217 PT_ACR1
=pt_off(acrs
[1]),
218 PT_ACR2
=pt_off(acrs
[2]),
219 PT_ACR3
=pt_off(acrs
[3]),
220 PT_ACR4
=pt_off(acrs
[4]),
221 PT_ACR5
=pt_off(acrs
[5]),
222 PT_ACR6
=pt_off(acrs
[6]),
223 PT_ACR7
=pt_off(acrs
[7]),
224 PT_ACR8
=pt_off(acrs
[8]),
225 PT_ACR9
=pt_off(acrs
[9]),
226 PT_ACR10
=pt_off(acrs
[10]),
227 PT_ACR11
=pt_off(acrs
[11]),
228 PT_ACR12
=pt_off(acrs
[12]),
229 PT_ACR13
=pt_off(acrs
[13]),
230 PT_ACR14
=pt_off(acrs
[14]),
231 PT_ACR15
=pt_off(acrs
[15]),
232 PT_ORIGGPR2
=pt_off(orig_gpr2
),
233 PT_FPC
=pt_off(fp_regs
.fpc
),
235 * A nasty fact of life that the ptrace api
236 * only supports passing of longs.
238 PT_FPR0_HI
=pt_off(fp_regs
.fprs
[0].fp
.hi
),
239 PT_FPR0_LO
=pt_off(fp_regs
.fprs
[0].fp
.lo
),
240 PT_FPR1_HI
=pt_off(fp_regs
.fprs
[1].fp
.hi
),
241 PT_FPR1_LO
=pt_off(fp_regs
.fprs
[1].fp
.lo
),
242 PT_FPR2_HI
=pt_off(fp_regs
.fprs
[2].fp
.hi
),
243 PT_FPR2_LO
=pt_off(fp_regs
.fprs
[2].fp
.lo
),
244 PT_FPR3_HI
=pt_off(fp_regs
.fprs
[3].fp
.hi
),
245 PT_FPR3_LO
=pt_off(fp_regs
.fprs
[3].fp
.lo
),
246 PT_FPR4_HI
=pt_off(fp_regs
.fprs
[4].fp
.hi
),
247 PT_FPR4_LO
=pt_off(fp_regs
.fprs
[4].fp
.lo
),
248 PT_FPR5_HI
=pt_off(fp_regs
.fprs
[5].fp
.hi
),
249 PT_FPR5_LO
=pt_off(fp_regs
.fprs
[5].fp
.lo
),
250 PT_FPR6_HI
=pt_off(fp_regs
.fprs
[6].fp
.hi
),
251 PT_FPR6_LO
=pt_off(fp_regs
.fprs
[6].fp
.lo
),
252 PT_FPR7_HI
=pt_off(fp_regs
.fprs
[7].fp
.hi
),
253 PT_FPR7_LO
=pt_off(fp_regs
.fprs
[7].fp
.lo
),
254 PT_FPR8_HI
=pt_off(fp_regs
.fprs
[8].fp
.hi
),
255 PT_FPR8_LO
=pt_off(fp_regs
.fprs
[8].fp
.lo
),
256 PT_FPR9_HI
=pt_off(fp_regs
.fprs
[9].fp
.hi
),
257 PT_FPR9_LO
=pt_off(fp_regs
.fprs
[9].fp
.lo
),
258 PT_FPR10_HI
=pt_off(fp_regs
.fprs
[10].fp
.hi
),
259 PT_FPR10_LO
=pt_off(fp_regs
.fprs
[10].fp
.lo
),
260 PT_FPR11_HI
=pt_off(fp_regs
.fprs
[11].fp
.hi
),
261 PT_FPR11_LO
=pt_off(fp_regs
.fprs
[11].fp
.lo
),
262 PT_FPR12_HI
=pt_off(fp_regs
.fprs
[12].fp
.hi
),
263 PT_FPR12_LO
=pt_off(fp_regs
.fprs
[12].fp
.lo
),
264 PT_FPR13_HI
=pt_off(fp_regs
.fprs
[13].fp
.hi
),
265 PT_FPR13_LO
=pt_off(fp_regs
.fprs
[13].fp
.lo
),
266 PT_FPR14_HI
=pt_off(fp_regs
.fprs
[14].fp
.hi
),
267 PT_FPR14_LO
=pt_off(fp_regs
.fprs
[14].fp
.lo
),
268 PT_FPR15_HI
=pt_off(fp_regs
.fprs
[15].fp
.hi
),
269 PT_FPR15_LO
=pt_off(fp_regs
.fprs
[15].fp
.lo
),
270 PT_CR_9
=pt_off(per_info
.control_regs
.words
.cr
[0]),
271 PT_CR_10
=pt_off(per_info
.control_regs
.words
.cr
[1]),
272 PT_CR_11
=pt_off(per_info
.control_regs
.words
.cr
[2]),
274 PT_ENDREGS
=offsetof(user_regs_struct
,per_info
.lowcore
.words
.perc_atmid
)
277 #define PTRACE_AREA \
279 addr_t kernel_addr; \
288 390 specific non posix ptrace requests
289 I chose unusual values so they are unlikely to clash with future ptrace definitions.
291 #define PTRACE_PEEKUSR_AREA 0x5000
292 #define PTRACE_POKEUSR_AREA 0x5001
293 #define PTRACE_PEEKTEXT_AREA 0x5002
294 #define PTRACE_PEEKDATA_AREA 0x5003
295 #define PTRACE_POKETEXT_AREA 0x5004
296 #define PTRACE_POKEDATA_AREA 0x5005
297 /* PT_PROT definition is loosely based on hppa bsd definition in gdb/hppab-nat.c */
298 #define PTRACE_PROT 21
302 ptprot_set_access_watchpoint
,
303 ptprot_set_write_watchpoint
,
304 ptprot_disable_watchpoint