MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / include / asm-sh / ptrace.h
bloba6f3b7c43e0f8f487c101829d5dcb9af5aabd671
1 #ifndef __ASM_SH_PTRACE_H
2 #define __ASM_SH_PTRACE_H
4 /*
5 * Copyright (C) 1999, 2000 Niibe Yutaka
7 */
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 * -----------------------------
19 * We follows above, except:
20 * 16 --- program counter (PC)
21 * 22 --- syscall #
22 * 23 --- floating point communication register
24 #define REG_REG0 0
25 #define REG_REG15 15
27 #define REG_PC 16
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
35 #define REG_SYSCALL 22
37 #define REG_FPREG0 23
38 #define REG_FPREG15 38
39 #define REG_XFREG0 39
40 #define REG_XFREG15 54
42 #define REG_FPSCR 55
43 #define REG_FPUL 56
45 /* options set using PTRACE_SETOPTIONS */
46 #define PTRACE_O_TRACESYSGOOD 0x00000001
49 * This struct defines the way the registers are stored on the
50 * kernel stack during a system call or other kernel entry.
52 struct 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;
64 * This struct defines the way the DSP registers are stored on the
65 * kernel stack during a system call or other kernel entry.
67 struct 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;
84 #define PTRACE_GETDSPREGS 55
85 #define PTRACE_SETDSPREGS 56
87 #ifdef __KERNEL__
88 #define user_stack(regs) ((regs)->regs[15])
89 #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
90 #define instruction_pointer(regs) ((regs)->pc)
91 extern void show_regs(struct pt_regs *);
93 #ifdef CONFIG_SH_DSP
94 #define task_pt_regs(task) \
95 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
96 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
97 #else
98 #define task_pt_regs(task) \
99 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
100 - sizeof(unsigned long)) - 1)
101 #endif
103 static inline unsigned long profile_pc(struct pt_regs *regs)
105 unsigned long pc = instruction_pointer(regs);
107 if (pc >= 0xa0000000UL && pc < 0xc0000000UL)
108 pc -= 0x20000000;
109 return pc;
111 #endif
113 #endif /* __ASM_SH_PTRACE_H */