more changes on original files
[linux-2.4.git] / include / asm-mips / ptrace.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000 by Ralf Baechle
7  *
8  * Machine dependent structs and defines to help the user use
9  * the ptrace system call.
10  */
11 #ifndef _ASM_PTRACE_H
12 #define _ASM_PTRACE_H
13
14 #include <asm/isadep.h>
15
16 /* 0 - 31 are integer registers, 32 - 63 are fp registers.  */
17 #define FPR_BASE        32
18 #define PC              64
19 #define CAUSE           65
20 #define BADVADDR        66
21 #define MMHI            67
22 #define MMLO            68
23 #define FPC_CSR         69
24 #define FPC_EIR         70
25
26 #ifndef __ASSEMBLY__
27 /*
28  * This struct defines the way the registers are stored on the stack during a
29  * system call/exception. As usual the registers k0/k1 aren't being saved.
30  */
31 struct pt_regs {
32         /* Pad bytes for argument save space on the stack. */
33         unsigned long pad0[6];
34
35         /* Saved main processor registers. */
36         unsigned long regs[32];
37
38         /* Saved special registers. */
39         unsigned long cp0_status;
40         unsigned long lo;
41         unsigned long hi;
42         unsigned long cp0_badvaddr;
43         unsigned long cp0_cause;
44         unsigned long cp0_epc;
45 };
46
47 #define __str2(x) #x
48 #define __str(x) __str2(x)
49
50 #define save_static_function(symbol)                                    \
51 __asm__ (                                                               \
52         ".globl\t" #symbol "\n\t"                                       \
53         ".align\t2\n\t"                                                 \
54         ".type\t" #symbol ", @function\n\t"                             \
55         ".ent\t" #symbol ", 0\n"                                        \
56         #symbol":\n\t"                                                  \
57         ".frame\t$29, 0, $31\n\t"                                       \
58         "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t"  \
59         "sw\t$17,"__str(PT_R17)"($29)\n\t"                              \
60         "sw\t$18,"__str(PT_R18)"($29)\n\t"                              \
61         "sw\t$19,"__str(PT_R19)"($29)\n\t"                              \
62         "sw\t$20,"__str(PT_R20)"($29)\n\t"                              \
63         "sw\t$21,"__str(PT_R21)"($29)\n\t"                              \
64         "sw\t$22,"__str(PT_R22)"($29)\n\t"                              \
65         "sw\t$23,"__str(PT_R23)"($29)\n\t"                              \
66         "sw\t$30,"__str(PT_R30)"($29)\n\t"                              \
67         ".end\t" #symbol "\n\t"                                         \
68         ".size\t" #symbol",. - " #symbol)
69
70 /* Used in declaration of save_static functions.  */
71 #define static_unused static __attribute__((unused))
72
73 #endif /* !__ASSEMBLY__ */
74
75 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
76 /* #define PTRACE_GETREGS               12 */
77 /* #define PTRACE_SETREGS               13 */
78 /* #define PTRACE_GETFPREGS             14 */
79 /* #define PTRACE_SETFPREGS             15 */
80 /* #define PTRACE_GETFPXREGS            18 */
81 /* #define PTRACE_SETFPXREGS            19 */
82
83 #define PTRACE_SETOPTIONS       21
84
85 /* options set using PTRACE_SETOPTIONS */
86 #define PTRACE_O_TRACESYSGOOD   0x00000001
87
88 #ifdef __ASSEMBLY__
89 #include <asm/offset.h>
90 #endif
91
92 #ifdef __KERNEL__
93
94 #ifndef __ASSEMBLY__
95 /*
96  * Does the process account for user or for system time?
97  */
98 #define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
99
100 #define instruction_pointer(regs) ((regs)->cp0_epc)
101
102 extern void show_regs(struct pt_regs *);
103 #endif /* !__ASSEMBLY__ */
104
105 #endif
106
107 #endif /* _ASM_PTRACE_H */