Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
[linux-2.6-block.git] / include / asm-sh / ptrace.h
CommitLineData
1da177e4
LT
1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H
3
1da177e4
LT
4/*
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
1da177e4
LT
45/*
46 * This struct defines the way the registers are stored on the
47 * kernel stack during a system call or other kernel entry.
48 */
49struct pt_regs {
50 unsigned long regs[16];
51 unsigned long pc;
52 unsigned long pr;
53 unsigned long sr;
54 unsigned long gbr;
55 unsigned long mach;
56 unsigned long macl;
57 long tra;
58};
59
60/*
61 * This struct defines the way the DSP registers are stored on the
62 * kernel stack during a system call or other kernel entry.
63 */
64struct pt_dspregs {
65 unsigned long a1;
66 unsigned long a0g;
67 unsigned long a1g;
68 unsigned long m0;
69 unsigned long m1;
70 unsigned long a0;
71 unsigned long x0;
72 unsigned long x1;
73 unsigned long y0;
74 unsigned long y1;
75 unsigned long dsr;
76 unsigned long rs;
77 unsigned long re;
78 unsigned long mod;
79};
80
81#define PTRACE_GETDSPREGS 55
82#define PTRACE_SETDSPREGS 56
83
84#ifdef __KERNEL__
85#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
86#define instruction_pointer(regs) ((regs)->pc)
87extern void show_regs(struct pt_regs *);
88
3cf0f4ec
AV
89#ifdef CONFIG_SH_DSP
90#define task_pt_regs(task) \
308a792f 91 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
3cf0f4ec
AV
92 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
93#else
94#define task_pt_regs(task) \
308a792f 95 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
3cf0f4ec
AV
96 - sizeof(unsigned long)) - 1)
97#endif
98
1da177e4
LT
99static inline unsigned long profile_pc(struct pt_regs *regs)
100{
101 unsigned long pc = instruction_pointer(regs);
102
103 if (pc >= 0xa0000000UL && pc < 0xc0000000UL)
104 pc -= 0x20000000;
105 return pc;
106}
107#endif
108
109#endif /* __ASM_SH_PTRACE_H */