xref: /kvm-unit-tests/lib/ppc64/asm/ptrace.h (revision 0cc3a351b925928827baa4b69cf0e46ff5837083)
1 #ifndef _ASMPPC64_PTRACE_H_
2 #define _ASMPPC64_PTRACE_H_
3 
4 #define KERNEL_REDZONE_SIZE	288
5 #define STACK_FRAME_OVERHEAD    112     /* size of minimum stack frame */
6 
7 #ifndef __ASSEMBLER__
8 
9 #include <asm/reg.h>
10 
11 struct pt_regs {
12 	unsigned long gpr[32];
13 	unsigned long nip;
14 	unsigned long msr;
15 	unsigned long ctr;
16 	unsigned long link;
17 	unsigned long xer;
18 	unsigned long ccr;
19 	unsigned long trap;
20 	unsigned long _pad; /* stack must be 16-byte aligned */
21 };
22 
regs_is_prefix(volatile struct pt_regs * regs)23 static inline bool regs_is_prefix(volatile struct pt_regs *regs)
24 {
25 	return regs->msr & SRR1_PREFIX;
26 }
27 
regs_advance_insn(struct pt_regs * regs)28 static inline void regs_advance_insn(struct pt_regs *regs)
29 {
30 	if (regs_is_prefix(regs))
31 		regs->nip += 8;
32 	else
33 		regs->nip += 4;
34 }
35 
36 #define STACK_INT_FRAME_SIZE    (sizeof(struct pt_regs) + \
37 				 STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
38 
39 #endif /* __ASSEMBLER__ */
40 
41 #endif /* _ASMPPC64_PTRACE_H_ */
42