xref: /openbmc/linux/arch/sh/include/asm/ptrace_32.h (revision 63dc02bd)
1 #ifndef __ASM_SH_PTRACE_32_H
2 #define __ASM_SH_PTRACE_32_H
3 
4 /*
5  * GCC defines register number like this:
6  * -----------------------------
7  *	 0 - 15 are integer registers
8  *	17 - 22 are control/special registers
9  *	24 - 39 fp registers
10  *	40 - 47 xd registers
11  *	48 -    fpscr register
12  * -----------------------------
13  *
14  * We follows above, except:
15  *	16 --- program counter (PC)
16  *	22 --- syscall #
17  *	23 --- floating point communication register
18  */
19 #define REG_REG0	 0
20 #define REG_REG15	15
21 
22 #define REG_PC		16
23 
24 #define REG_PR		17
25 #define REG_SR		18
26 #define REG_GBR		19
27 #define REG_MACH	20
28 #define REG_MACL	21
29 
30 #define REG_SYSCALL	22
31 
32 #define REG_FPREG0	23
33 #define REG_FPREG15	38
34 #define REG_XFREG0	39
35 #define REG_XFREG15	54
36 
37 #define REG_FPSCR	55
38 #define REG_FPUL	56
39 
40 /*
41  * This struct defines the way the registers are stored on the
42  * kernel stack during a system call or other kernel entry.
43  */
44 struct pt_regs {
45 	unsigned long regs[16];
46 	unsigned long pc;
47 	unsigned long pr;
48 	unsigned long sr;
49 	unsigned long gbr;
50 	unsigned long mach;
51 	unsigned long macl;
52 	long tra;
53 };
54 
55 /*
56  * This struct defines the way the DSP registers are stored on the
57  * kernel stack during a system call or other kernel entry.
58  */
59 struct pt_dspregs {
60 	unsigned long	a1;
61 	unsigned long	a0g;
62 	unsigned long	a1g;
63 	unsigned long	m0;
64 	unsigned long	m1;
65 	unsigned long	a0;
66 	unsigned long	x0;
67 	unsigned long	x1;
68 	unsigned long	y0;
69 	unsigned long	y1;
70 	unsigned long	dsr;
71 	unsigned long	rs;
72 	unsigned long	re;
73 	unsigned long	mod;
74 };
75 
76 #ifdef __KERNEL__
77 
78 #define MAX_REG_OFFSET		offsetof(struct pt_regs, tra)
79 static inline long regs_return_value(struct pt_regs *regs)
80 {
81 	return regs->regs[0];
82 }
83 
84 #endif /* __KERNEL__ */
85 
86 #endif /* __ASM_SH_PTRACE_32_H */
87