[POWERPC] Small fixes for the Ebony device tree
[linux-ginger.git] / include / asm-sh / ptrace.h
blobed358a376e6ea19ab31ef4fc14370dfe0a2003f8
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_mode(regs) (((regs)->sr & 0x40000000)==0)
89 #define instruction_pointer(regs) ((regs)->pc)
90 extern void show_regs(struct pt_regs *);
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
102 static inline unsigned long profile_pc(struct pt_regs *regs)
104 unsigned long pc = instruction_pointer(regs);
106 if (pc >= 0xa0000000UL && pc < 0xc0000000UL)
107 pc -= 0x20000000;
108 return pc;
110 #endif
112 #endif /* __ASM_SH_PTRACE_H */