1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#define REG_REG0 0
25#define REG_REG15 15
26
27#define REG_PC 16
28
29#define REG_PR 17
30#define REG_SR 18
31#define REG_GBR 19
32#define REG_MACH 20
33#define REG_MACL 21
34
35#define REG_SYSCALL 22
36
37#define REG_FPREG0 23
38#define REG_FPREG15 38
39#define REG_XFREG0 39
40#define REG_XFREG15 54
41
42#define REG_FPSCR 55
43#define REG_FPUL 56
44
45
46#define PTRACE_O_TRACESYSGOOD 0x00000001
47
48
49
50
51
52struct pt_regs {
53 unsigned long regs[16];
54 unsigned long pc;
55 unsigned long pr;
56 unsigned long sr;
57 unsigned long gbr;
58 unsigned long mach;
59 unsigned long macl;
60 long tra;
61};
62
63
64
65
66
67struct pt_dspregs {
68 unsigned long a1;
69 unsigned long a0g;
70 unsigned long a1g;
71 unsigned long m0;
72 unsigned long m1;
73 unsigned long a0;
74 unsigned long x0;
75 unsigned long x1;
76 unsigned long y0;
77 unsigned long y1;
78 unsigned long dsr;
79 unsigned long rs;
80 unsigned long re;
81 unsigned long mod;
82};
83
84#define PTRACE_GETDSPREGS 55
85#define PTRACE_SETDSPREGS 56
86
87#ifdef __KERNEL__
88#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
89#define instruction_pointer(regs) ((regs)->pc)
90extern void show_regs(struct pt_regs *);
91
92#ifdef CONFIG_SH_DSP
93#define task_pt_regs(task) \
94 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
95 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
96#else
97#define task_pt_regs(task) \
98 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
99 - sizeof(unsigned long)) - 1)
100#endif
101
102static inline unsigned long profile_pc(struct pt_regs *regs)
103{
104 unsigned long pc = instruction_pointer(regs);
105
106 if (pc >= 0xa0000000UL && pc < 0xc0000000UL)
107 pc -= 0x20000000;
108 return pc;
109}
110#endif
111
112#endif
113