blob: ed358a376e6ea19ab31ef4fc14370dfe0a2003f8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka
6 *
7 */
8
9/*
10 * GCC defines register number like this:
11 * -----------------------------
12 * 0 - 15 are integer registers
13 * 17 - 22 are control/special registers
14 * 24 - 39 fp registers
15 * 40 - 47 xd registers
16 * 48 - fpscr register
17 * -----------------------------
18 *
19 * We follows above, except:
20 * 16 --- program counter (PC)
21 * 22 --- syscall #
22 * 23 --- floating point communication register
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/* options set using PTRACE_SETOPTIONS */
46#define PTRACE_O_TRACESYSGOOD 0x00000001
47
48/*
49 * This struct defines the way the registers are stored on the
50 * kernel stack during a system call or other kernel entry.
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 * This struct defines the way the DSP registers are stored on the
65 * kernel stack during a system call or other kernel entry.
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
Al Viro3cf0f4e2006-01-12 01:05:44 -080092#ifdef CONFIG_SH_DSP
93#define task_pt_regs(task) \
Al Viro308a7922006-01-12 01:05:45 -080094 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
Al Viro3cf0f4e2006-01-12 01:05:44 -080095 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
96#else
97#define task_pt_regs(task) \
Al Viro308a7922006-01-12 01:05:45 -080098 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
Al Viro3cf0f4e2006-01-12 01:05:44 -080099 - sizeof(unsigned long)) - 1)
100#endif
101
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102static 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 /* __ASM_SH_PTRACE_H */