File: /usr/src/linux/include/asm-mips/gdb-stub.h

1     /* $Id: gdb-stub.h,v 1.3 1998/07/20 17:52:19 ralf Exp $
2      *
3      * This file is subject to the terms and conditions of the GNU General Public
4      * License.  See the file "COPYING" in the main directory of this archive
5      * for more details.
6      *
7      * Copyright (C) 1995 Andreas Busse
8      */
9     #ifndef __ASM_MIPS_GDB_STUB_H
10     #define __ASM_MIPS_GDB_STUB_H
11     
12     
13     /*
14      * important register numbers
15      */
16     
17     #define REG_EPC			37
18     #define REG_FP			72
19     #define REG_SP			29
20     
21     /*
22      * Stack layout for the GDB exception handler
23      * Derived from the stack layout described in asm-mips/stackframe.h
24      *
25      * The first PTRSIZE*5 bytes are argument save space for C subroutines.
26      */
27     #define NUMREGS			90
28     
29     #define GDB_FR_REG0		(PTRSIZE*5)			/* 0 */
30     #define GDB_FR_REG1		((GDB_FR_REG0) + 4)		/* 1 */
31     #define GDB_FR_REG2		((GDB_FR_REG1) + 4)		/* 2 */
32     #define GDB_FR_REG3		((GDB_FR_REG2) + 4)		/* 3 */
33     #define GDB_FR_REG4		((GDB_FR_REG3) + 4)		/* 4 */
34     #define GDB_FR_REG5		((GDB_FR_REG4) + 4)		/* 5 */
35     #define GDB_FR_REG6		((GDB_FR_REG5) + 4)		/* 6 */
36     #define GDB_FR_REG7		((GDB_FR_REG6) + 4)		/* 7 */
37     #define GDB_FR_REG8		((GDB_FR_REG7) + 4)		/* 8 */
38     #define GDB_FR_REG9	        ((GDB_FR_REG8) + 4)		/* 9 */
39     #define GDB_FR_REG10		((GDB_FR_REG9) + 4)		/* 10 */
40     #define GDB_FR_REG11		((GDB_FR_REG10) + 4)		/* 11 */
41     #define GDB_FR_REG12		((GDB_FR_REG11) + 4)		/* 12 */
42     #define GDB_FR_REG13		((GDB_FR_REG12) + 4)		/* 13 */
43     #define GDB_FR_REG14		((GDB_FR_REG13) + 4)		/* 14 */
44     #define GDB_FR_REG15		((GDB_FR_REG14) + 4)		/* 15 */
45     #define GDB_FR_REG16		((GDB_FR_REG15) + 4)		/* 16 */
46     #define GDB_FR_REG17		((GDB_FR_REG16) + 4)		/* 17 */
47     #define GDB_FR_REG18		((GDB_FR_REG17) + 4)		/* 18 */
48     #define GDB_FR_REG19		((GDB_FR_REG18) + 4)		/* 19 */
49     #define GDB_FR_REG20		((GDB_FR_REG19) + 4)		/* 20 */
50     #define GDB_FR_REG21		((GDB_FR_REG20) + 4)		/* 21 */
51     #define GDB_FR_REG22		((GDB_FR_REG21) + 4)		/* 22 */
52     #define GDB_FR_REG23		((GDB_FR_REG22) + 4)		/* 23 */
53     #define GDB_FR_REG24		((GDB_FR_REG23) + 4)		/* 24 */
54     #define GDB_FR_REG25		((GDB_FR_REG24) + 4)		/* 25 */
55     #define GDB_FR_REG26		((GDB_FR_REG25) + 4)		/* 26 */
56     #define GDB_FR_REG27		((GDB_FR_REG26) + 4)		/* 27 */
57     #define GDB_FR_REG28		((GDB_FR_REG27) + 4)		/* 28 */
58     #define GDB_FR_REG29		((GDB_FR_REG28) + 4)		/* 29 */
59     #define GDB_FR_REG30		((GDB_FR_REG29) + 4)		/* 30 */
60     #define GDB_FR_REG31		((GDB_FR_REG30) + 4)		/* 31 */
61     	
62     /*
63      * Saved special registers
64      */
65     #define GDB_FR_STATUS		((GDB_FR_REG31) + 4)		/* 32 */
66     #define GDB_FR_LO		((GDB_FR_STATUS) + 4)		/* 33 */
67     #define GDB_FR_HI		((GDB_FR_LO) + 4)		/* 34 */
68     #define GDB_FR_BADVADDR		((GDB_FR_HI) + 4)		/* 35 */
69     #define GDB_FR_CAUSE		((GDB_FR_BADVADDR) + 4)		/* 36 */
70     #define GDB_FR_EPC		((GDB_FR_CAUSE) + 4)		/* 37 */
71     
72     /*
73      * Saved floating point registers
74      */
75     #define GDB_FR_FPR0		((GDB_FR_EPC) + 4)		/* 38 */
76     #define GDB_FR_FPR1		((GDB_FR_FPR0) + 4)		/* 39 */
77     #define GDB_FR_FPR2		((GDB_FR_FPR1) + 4)		/* 40 */
78     #define GDB_FR_FPR3		((GDB_FR_FPR2) + 4)		/* 41 */
79     #define GDB_FR_FPR4		((GDB_FR_FPR3) + 4)		/* 42 */
80     #define GDB_FR_FPR5		((GDB_FR_FPR4) + 4)		/* 43 */
81     #define GDB_FR_FPR6		((GDB_FR_FPR5) + 4)		/* 44 */
82     #define GDB_FR_FPR7		((GDB_FR_FPR6) + 4)		/* 45 */
83     #define GDB_FR_FPR8		((GDB_FR_FPR7) + 4)		/* 46 */
84     #define GDB_FR_FPR9		((GDB_FR_FPR8) + 4)		/* 47 */
85     #define GDB_FR_FPR10		((GDB_FR_FPR9) + 4)		/* 48 */
86     #define GDB_FR_FPR11		((GDB_FR_FPR10) + 4)		/* 49 */
87     #define GDB_FR_FPR12		((GDB_FR_FPR11) + 4)		/* 50 */
88     #define GDB_FR_FPR13		((GDB_FR_FPR12) + 4)		/* 51 */
89     #define GDB_FR_FPR14		((GDB_FR_FPR13) + 4)		/* 52 */
90     #define GDB_FR_FPR15		((GDB_FR_FPR14) + 4)		/* 53 */
91     #define GDB_FR_FPR16		((GDB_FR_FPR15) + 4)		/* 54 */
92     #define GDB_FR_FPR17		((GDB_FR_FPR16) + 4)		/* 55 */
93     #define GDB_FR_FPR18		((GDB_FR_FPR17) + 4)		/* 56 */
94     #define GDB_FR_FPR19		((GDB_FR_FPR18) + 4)		/* 57 */
95     #define GDB_FR_FPR20		((GDB_FR_FPR19) + 4)		/* 58 */
96     #define GDB_FR_FPR21		((GDB_FR_FPR20) + 4)		/* 59 */
97     #define GDB_FR_FPR22		((GDB_FR_FPR21) + 4)		/* 60 */
98     #define GDB_FR_FPR23		((GDB_FR_FPR22) + 4)		/* 61 */
99     #define GDB_FR_FPR24		((GDB_FR_FPR23) + 4)		/* 62 */
100     #define GDB_FR_FPR25		((GDB_FR_FPR24) + 4)		/* 63 */
101     #define GDB_FR_FPR26		((GDB_FR_FPR25) + 4)		/* 64 */
102     #define GDB_FR_FPR27		((GDB_FR_FPR26) + 4)		/* 65 */
103     #define GDB_FR_FPR28		((GDB_FR_FPR27) + 4)		/* 66 */
104     #define GDB_FR_FPR29		((GDB_FR_FPR28) + 4)		/* 67 */
105     #define GDB_FR_FPR30		((GDB_FR_FPR29) + 4)		/* 68 */
106     #define GDB_FR_FPR31		((GDB_FR_FPR30) + 4)		/* 69 */
107     
108     #define GDB_FR_FSR		((GDB_FR_FPR31) + 4)		/* 70 */
109     #define GDB_FR_FIR		((GDB_FR_FSR) + 4)		/* 71 */
110     #define GDB_FR_FRP		((GDB_FR_FIR) + 4)		/* 72 */
111     
112     #define GDB_FR_DUMMY		((GDB_FR_FRP) + 4)		/* 73, unused ??? */
113     
114     /*
115      * Again, CP0 registers
116      */
117     #define GDB_FR_CP0_INDEX	((GDB_FR_DUMMY) + 4)		/* 74 */
118     #define GDB_FR_CP0_RANDOM	((GDB_FR_CP0_INDEX) + 4)	/* 75 */
119     #define GDB_FR_CP0_ENTRYLO0	((GDB_FR_CP0_RANDOM) + 4)	/* 76 */
120     #define GDB_FR_CP0_ENTRYLO1	((GDB_FR_CP0_ENTRYLO0) + 4)	/* 77 */
121     #define GDB_FR_CP0_CONTEXT	((GDB_FR_CP0_ENTRYLO1) + 4)	/* 78 */
122     #define GDB_FR_CP0_PAGEMASK	((GDB_FR_CP0_CONTEXT) + 4)	/* 79 */
123     #define GDB_FR_CP0_WIRED	((GDB_FR_CP0_PAGEMASK) + 4)	/* 80 */
124     #define GDB_FR_CP0_REG7		((GDB_FR_CP0_WIRED) + 4)	/* 81 */
125     #define GDB_FR_CP0_REG8		((GDB_FR_CP0_REG7) + 4)		/* 82 */
126     #define GDB_FR_CP0_REG9		((GDB_FR_CP0_REG8) + 4)		/* 83 */
127     #define GDB_FR_CP0_ENTRYHI	((GDB_FR_CP0_REG9) + 4)		/* 84 */
128     #define GDB_FR_CP0_REG11	((GDB_FR_CP0_ENTRYHI) + 4)	/* 85 */
129     #define GDB_FR_CP0_REG12	((GDB_FR_CP0_REG11) + 4)	/* 86 */
130     #define GDB_FR_CP0_REG13	((GDB_FR_CP0_REG12) + 4)	/* 87 */
131     #define GDB_FR_CP0_REG14	((GDB_FR_CP0_REG13) + 4)	/* 88 */
132     #define GDB_FR_CP0_PRID		((GDB_FR_CP0_REG14) + 4)	/* 89 */
133     
134     #define GDB_FR_SIZE		((((GDB_FR_CP0_PRID) + 4) + (PTRSIZE-1)) & ~(PTRSIZE-1))
135     
136     #ifndef _LANGUAGE_ASSEMBLY
137     
138     /*
139      * This is the same as above, but for the high-level
140      * part of the GDB stub.
141      */
142     
143     struct gdb_regs {
144     	/*
145     	 * Pad bytes for argument save space on the stack
146     	 * 20/40 Bytes for 32/64 bit code
147     	 */
148     	unsigned long pad0[5];
149     
150     	/*
151     	 * saved main processor registers
152     	 */
153     	long	 reg0,  reg1,  reg2,  reg3,  reg4,  reg5,  reg6,  reg7;
154     	long	 reg8,  reg9, reg10, reg11, reg12, reg13, reg14, reg15;
155     	long	reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
156     	long	reg24, reg25, reg26, reg27, reg28, reg29, reg30, reg31;
157     
158     	/*
159     	 * Saved special registers
160     	 */
161     	long	cp0_status;
162     	long	lo;
163     	long	hi;
164     	long	cp0_badvaddr;
165     	long	cp0_cause;
166     	long	cp0_epc;
167     
168     	/*
169     	 * Saved floating point registers
170     	 */
171     	long	fpr0,  fpr1,  fpr2,  fpr3,  fpr4,  fpr5,  fpr6,  fpr7;
172     	long	fpr8,  fpr9,  fpr10, fpr11, fpr12, fpr13, fpr14, fpr15;
173     	long	fpr16, fpr17, fpr18, fpr19, fpr20, fpr21, fpr22, fpr23;
174     	long	fpr24, fpr25, fpr26, fpr27, fpr28, fpr29, fpr30, fpr31;
175     
176     	long	cp1_fsr;
177     	long	cp1_fir;
178     
179     	/*
180     	 * Frame pointer
181     	 */
182     	long	frame_ptr;
183     	long    dummy;		/* unused */
184     	
185     	/*
186     	 * saved cp0 registers
187     	 */
188     	long	cp0_index;
189     	long	cp0_random;
190     	long	cp0_entrylo0;
191     	long	cp0_entrylo1;
192     	long	cp0_context;
193     	long	cp0_pagemask;
194     	long	cp0_wired;
195     	long	cp0_reg7;
196     	long	cp0_reg8;
197     	long	cp0_reg9;
198     	long	cp0_entryhi;
199     	long	cp0_reg11;
200     	long	cp0_reg12;
201     	long	cp0_reg13;
202     	long	cp0_reg14;
203     	long	cp0_prid;
204     };
205     
206     /*
207      * Prototypes
208      */
209     
210     void set_debug_traps(void);
211     
212     #endif /* _LANGUAGE_ASSEMBLY */
213     #endif /* __ASM_MIPS_GDB_STUB_H */
214