1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_MIPS_REGS_H
|
2 |
|
|
#define CYGONCE_HAL_MIPS_REGS_H
|
3 |
|
|
//========================================================================
|
4 |
|
|
//
|
5 |
|
|
// mips-regs.h
|
6 |
|
|
//
|
7 |
|
|
// Register defines for MIPS processors
|
8 |
|
|
//
|
9 |
|
|
//========================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//========================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): Red Hat, nickg
|
45 |
|
|
// Contributors: Red Hat, nickg, dmoseley
|
46 |
|
|
// Date: 1998-06-08
|
47 |
|
|
// Purpose:
|
48 |
|
|
// Description: Register defines for MIPS processors
|
49 |
|
|
// Usage:
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
//========================================================================
|
54 |
|
|
|
55 |
|
|
#include <pkgconf/hal.h>
|
56 |
|
|
|
57 |
|
|
#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
58 |
|
|
|
59 |
|
|
/* This value must agree with NUMREGS in mips-stub.h. */
|
60 |
|
|
|
61 |
|
|
#if defined(CYGPKG_HAL_MIPS_GDB_REPORT_CP0)
|
62 |
|
|
#define NUM_REGS 107
|
63 |
|
|
#else
|
64 |
|
|
#define NUM_REGS 90
|
65 |
|
|
#endif
|
66 |
|
|
|
67 |
|
|
#ifdef __mips64
|
68 |
|
|
#define REG_SIZE 8
|
69 |
|
|
#else
|
70 |
|
|
#define REG_SIZE 4
|
71 |
|
|
#endif
|
72 |
|
|
|
73 |
|
|
/* General register names for assembly code. */
|
74 |
|
|
|
75 |
|
|
#define zero $0
|
76 |
|
|
#define at $1 /* assembler temporary */
|
77 |
|
|
#define atmp $1 /* assembler temporary */
|
78 |
|
|
#define v0 $2 /* value holders */
|
79 |
|
|
#define v1 $3
|
80 |
|
|
#define a0 $4 /* arguments */
|
81 |
|
|
#define a1 $5
|
82 |
|
|
#define a2 $6
|
83 |
|
|
#define a3 $7
|
84 |
|
|
#define t0 $8 /* temporaries */
|
85 |
|
|
#define t1 $9
|
86 |
|
|
#define t2 $10
|
87 |
|
|
#define t3 $11
|
88 |
|
|
#define t4 $12
|
89 |
|
|
#define t5 $13
|
90 |
|
|
#define t6 $14
|
91 |
|
|
#define t7 $15
|
92 |
|
|
#define s0 $16 /* saved registers */
|
93 |
|
|
#define s1 $17
|
94 |
|
|
#define s2 $18
|
95 |
|
|
#define s3 $19
|
96 |
|
|
#define s4 $20
|
97 |
|
|
#define s5 $21
|
98 |
|
|
#define s6 $22
|
99 |
|
|
#define s7 $23
|
100 |
|
|
#define t8 $24 /* temporaries */
|
101 |
|
|
#define t9 $25
|
102 |
|
|
#define k0 $26 /* kernel registers */
|
103 |
|
|
#define k1 $27
|
104 |
|
|
#define gp $28 /* global pointer */
|
105 |
|
|
#define sp $29 /* stack pointer */
|
106 |
|
|
#define s8 $30 /* saved register */
|
107 |
|
|
#define fp $30 /* frame pointer (obsolete usage) */
|
108 |
|
|
#define ra $31 /* return address */
|
109 |
|
|
|
110 |
|
|
/* MIPS registers, numbered in the order in which gdb expects to see them. */
|
111 |
|
|
#define ZERO 0
|
112 |
|
|
#define AT 1
|
113 |
|
|
#define ATMP 1
|
114 |
|
|
#define V0 2
|
115 |
|
|
#define V1 3
|
116 |
|
|
#define A0 4
|
117 |
|
|
#define A1 5
|
118 |
|
|
#define A2 6
|
119 |
|
|
#define A3 7
|
120 |
|
|
|
121 |
|
|
#define T0 8
|
122 |
|
|
#define T1 9
|
123 |
|
|
#define T2 10
|
124 |
|
|
#define T3 11
|
125 |
|
|
#define T4 12
|
126 |
|
|
#define T5 13
|
127 |
|
|
#define T6 14
|
128 |
|
|
#define T7 15
|
129 |
|
|
|
130 |
|
|
#define S0 16
|
131 |
|
|
#define S1 17
|
132 |
|
|
#define S2 18
|
133 |
|
|
#define S3 19
|
134 |
|
|
#define S4 20
|
135 |
|
|
#define S5 21
|
136 |
|
|
#define S6 22
|
137 |
|
|
#define S7 23
|
138 |
|
|
|
139 |
|
|
#define T8 24
|
140 |
|
|
#define T9 25
|
141 |
|
|
#define K0 26
|
142 |
|
|
#define K1 27
|
143 |
|
|
#define GP 28
|
144 |
|
|
#define SP 29
|
145 |
|
|
#define S8 30
|
146 |
|
|
#define RA 31
|
147 |
|
|
|
148 |
|
|
#define SR 32
|
149 |
|
|
#define LO 33
|
150 |
|
|
#define HI 34
|
151 |
|
|
#define BAD_VA 35
|
152 |
|
|
#define CAUSE 36
|
153 |
|
|
#define PC 37
|
154 |
|
|
|
155 |
|
|
#define F0 38
|
156 |
|
|
#define F1 39
|
157 |
|
|
#define F2 40
|
158 |
|
|
#define F3 41
|
159 |
|
|
#define F4 42
|
160 |
|
|
#define F5 43
|
161 |
|
|
#define F6 44
|
162 |
|
|
#define F7 45
|
163 |
|
|
#define F8 46
|
164 |
|
|
#define F9 47
|
165 |
|
|
#define F10 48
|
166 |
|
|
#define F11 49
|
167 |
|
|
#define F12 50
|
168 |
|
|
#define F13 51
|
169 |
|
|
#define F14 52
|
170 |
|
|
#define F15 53
|
171 |
|
|
#define F16 54
|
172 |
|
|
#define F17 55
|
173 |
|
|
#define F18 56
|
174 |
|
|
#define F19 57
|
175 |
|
|
#define F20 58
|
176 |
|
|
#define F21 59
|
177 |
|
|
#define F22 60
|
178 |
|
|
#define F23 61
|
179 |
|
|
#define F24 62
|
180 |
|
|
#define F25 63
|
181 |
|
|
#define F26 64
|
182 |
|
|
#define F27 65
|
183 |
|
|
#define F28 66
|
184 |
|
|
#define F29 67
|
185 |
|
|
#define F30 68
|
186 |
|
|
#define F31 69
|
187 |
|
|
|
188 |
|
|
#define FCR31 70
|
189 |
|
|
|
190 |
|
|
/* System Control Coprocessor (CP0) exception processing registers */
|
191 |
|
|
#define C0_CONTEXT $4 /* Context */
|
192 |
|
|
#define C0_BADVADDR $8 /* Bad Virtual Address */
|
193 |
|
|
#define C0_COUNT $9 /* Count */
|
194 |
|
|
#define C0_COMPARE $11 /* Compare */
|
195 |
|
|
#define C0_STATUS $12 /* Processor Status */
|
196 |
|
|
#define C0_CAUSE $13 /* Exception Cause */
|
197 |
|
|
#define C0_EPC $14 /* Exception PC */
|
198 |
|
|
#define C0_WATCHLO $18 /* Watchpoint LO */
|
199 |
|
|
#define C0_WATCHHI $19 /* Watchpoint HI */
|
200 |
|
|
#define C0_XCONTEXT $20 /* XContext */
|
201 |
|
|
#define C0_ECC $26 /* ECC */
|
202 |
|
|
#define C0_CACHEERR $27 /* CacheErr */
|
203 |
|
|
#define C0_ERROREPC $30 /* ErrorEPC */
|
204 |
|
|
|
205 |
|
|
/* Status register fields */
|
206 |
|
|
#define SR_CUMASK 0xf0000000 /* Coprocessor usable bits */
|
207 |
|
|
#define SR_CU3 0x80000000 /* Coprocessor 3 usable */
|
208 |
|
|
#define SR_CU2 0x40000000 /* coprocessor 2 usable */
|
209 |
|
|
#define SR_CU1 0x20000000 /* Coprocessor 1 usable */
|
210 |
|
|
#define SR_CU0 0x10000000 /* Coprocessor 0 usable */
|
211 |
|
|
|
212 |
|
|
#define SR_FR 0x04000000 /* Enable 32 floating-point registers */
|
213 |
|
|
#define SR_RE 0x02000000 /* Reverse Endian in user mode */
|
214 |
|
|
|
215 |
|
|
#define SR_BEV 0x00400000 /* Bootstrap Exception Vector */
|
216 |
|
|
#define SR_TS 0x00200000 /* TLB shutdown (reserved on R4600) */
|
217 |
|
|
#define SR_SR 0x00100000 /* Soft Reset */
|
218 |
|
|
|
219 |
|
|
#define SR_CH 0x00040000 /* Cache Hit */
|
220 |
|
|
#define SR_CE 0x00020000 /* ECC register modifies check bits */
|
221 |
|
|
#define SR_DE 0x00010000 /* Disable cache errors */
|
222 |
|
|
|
223 |
|
|
#define SR_IMASK 0x0000ff00 /* Interrupt Mask */
|
224 |
|
|
#define SR_IMASK8 0x00000000 /* Interrupt Mask level=8 */
|
225 |
|
|
#define SR_IMASK7 0x00008000 /* Interrupt Mask level=7 */
|
226 |
|
|
#define SR_IMASK6 0x0000c000 /* Interrupt Mask level=6 */
|
227 |
|
|
#define SR_IMASK5 0x0000e000 /* Interrupt Mask level=5 */
|
228 |
|
|
#define SR_IMASK4 0x0000f000 /* Interrupt Mask level=4 */
|
229 |
|
|
#define SR_IMASK3 0x0000f800 /* Interrupt Mask level=3 */
|
230 |
|
|
#define SR_IMASK2 0x0000fc00 /* Interrupt Mask level=2 */
|
231 |
|
|
#define SR_IMASK1 0x0000fe00 /* Interrupt Mask level=1 */
|
232 |
|
|
#define SR_IMASK0 0x0000ff00 /* Interrupt Mask level=0 */
|
233 |
|
|
|
234 |
|
|
#define SR_IBIT8 0x00008000 /* (Intr5) */
|
235 |
|
|
#define SR_IBIT7 0x00004000 /* (Intr4) */
|
236 |
|
|
#define SR_IBIT6 0x00002000 /* (Intr3) */
|
237 |
|
|
#define SR_IBIT5 0x00001000 /* (Intr2) */
|
238 |
|
|
#define SR_IBIT4 0x00000800 /* (Intr1) */
|
239 |
|
|
#define SR_IBIT3 0x00000400 /* (Intr0) */
|
240 |
|
|
#define SR_IBIT2 0x00000200 /* (Software Interrupt 1) */
|
241 |
|
|
#define SR_IBIT1 0x00000100 /* (Software Interrupt 0) */
|
242 |
|
|
|
243 |
|
|
#define SR_KX 0x00000080 /* xtlb in kernel mode */
|
244 |
|
|
#define SR_SX 0x00000040 /* mips3 & xtlb in supervisor mode */
|
245 |
|
|
#define SR_UX 0x00000020 /* mips3 & xtlb in user mode */
|
246 |
|
|
|
247 |
|
|
#define SR_KSU_MASK 0x00000018 /* ksu mode mask */
|
248 |
|
|
#define SR_KSU_USER 0x00000010 /* user mode */
|
249 |
|
|
#define SR_KSU_SUPV 0x00000008 /* supervisor mode */
|
250 |
|
|
#define SR_KSU_KERN 0x00000000 /* kernel mode */
|
251 |
|
|
|
252 |
|
|
#define SR_ERL 0x00000004 /* error level */
|
253 |
|
|
#define SR_EXL 0x00000002 /* exception level */
|
254 |
|
|
#define SR_IE 0x00000001 /* interrupt enable */
|
255 |
|
|
|
256 |
|
|
/* Floating-point unit control/status register (FCR31) */
|
257 |
|
|
#define FCR31_FS 0x01000000 /* Flush denormalized to zero */
|
258 |
|
|
#define FCR31_C 0x00800000 /* FP compare result */
|
259 |
|
|
|
260 |
|
|
#define FCR31_CAUSE_E 0x00020000 /* Cause - unimplemented operation */
|
261 |
|
|
#define FCR31_CAUSE_V 0x00010000 /* Cause - invalid operation */
|
262 |
|
|
#define FCR31_CAUSE_Z 0x00008000 /* Cause - division by zero */
|
263 |
|
|
#define FCR31_CAUSE_O 0x00004000 /* Cause - overflow */
|
264 |
|
|
#define FCR31_CAUSE_U 0x00002000 /* Cause - underflow */
|
265 |
|
|
#define FCR31_CAUSE_I 0x00001000 /* Cause - inexact operation */
|
266 |
|
|
|
267 |
|
|
#define FCR31_ENABLES_V 0x00000800 /* Enables - invalid operation */
|
268 |
|
|
#define FCR31_ENABLES_Z 0x00000400 /* Enables - division by zero */
|
269 |
|
|
#define FCR31_ENABLES_O 0x00000200 /* Enables - overflow */
|
270 |
|
|
#define FCR31_ENABLES_U 0x00000100 /* Enables - underflow */
|
271 |
|
|
#define FCR31_ENABLES_I 0x00000080 /* Enables - inexact operation */
|
272 |
|
|
|
273 |
|
|
#define FCR31_FLAGS_V 0x00000040 /* Flags - invalid operation */
|
274 |
|
|
#define FCR31_FLAGS_Z 0x00000020 /* Flags - division by zero */
|
275 |
|
|
#define FCR31_FLAGS_O 0x00000010 /* Flags - overflow */
|
276 |
|
|
#define FCR31_FLAGS_U 0x00000008 /* Flags - underflow */
|
277 |
|
|
#define FCR31_FLAGS_I 0x00000004 /* Flags - inexact operation */
|
278 |
|
|
|
279 |
|
|
#define FCR31_RMMASK 0x00000002 /* Rounding mode mask */
|
280 |
|
|
#define FCR31_RM_RN 0 /* Round to nearest */
|
281 |
|
|
#define FCR31_RM_RZ 1 /* Round to zero */
|
282 |
|
|
#define FCR31_RM_RP 2 /* Round to +infinity */
|
283 |
|
|
#define FCR31_RM_RM 3 /* Round to -infinity */
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
/* Cause register fields */
|
287 |
|
|
#define CAUSE_BD 0x80000000 /* Branch Delay */
|
288 |
|
|
#define CAUSE_CEMASK 0x30000000 /* Coprocessor Error */
|
289 |
|
|
#define CAUSE_CESHIFT 28 /* Right justify CE */
|
290 |
|
|
#define CAUSE_IPMASK 0x0000ff00 /* Interrupt Pending */
|
291 |
|
|
#define CAUSE_IPSHIFT 8 /* Right justify IP */
|
292 |
|
|
#define CAUSE_IP8 0x00008000 /* (Intr5) */
|
293 |
|
|
#define CAUSE_IP7 0x00004000 /* (Intr4) */
|
294 |
|
|
#define CAUSE_IP6 0x00002000 /* (Intr3) */
|
295 |
|
|
#define CAUSE_IP5 0x00001000 /* (Intr2) */
|
296 |
|
|
#define CAUSE_IP4 0x00000800 /* (Intr1) */
|
297 |
|
|
#define CAUSE_IP3 0x00000400 /* (Intr0) */
|
298 |
|
|
#define CAUSE_SW2 0x00000200 /* (Software Interrupt 1) */
|
299 |
|
|
#define CAUSE_SW1 0x00000100 /* (Software Interrupt 0) */
|
300 |
|
|
#define CAUSE_EXCMASK 0x0000007c /* Exception Code */
|
301 |
|
|
#define CAUSE_EXCSHIFT 2 /* Right justify EXC */
|
302 |
|
|
|
303 |
|
|
/* Exception Codes */
|
304 |
|
|
#define EXC_INT 0 /* External interrupt */
|
305 |
|
|
#define EXC_MOD 1 /* TLB modification exception */
|
306 |
|
|
#define EXC_TLBL 2 /* TLB miss (Load or Ifetch) */
|
307 |
|
|
#define EXC_TLBS 3 /* TLB miss (Store) */
|
308 |
|
|
#define EXC_ADEL 4 /* Address error (Load or Ifetch) */
|
309 |
|
|
#define EXC_ADES 5 /* Address error (Store) */
|
310 |
|
|
#define EXC_IBE 6 /* Bus error (Ifetch) */
|
311 |
|
|
#define EXC_DBE 7 /* Bus error (data load or store) */
|
312 |
|
|
#define EXC_SYS 8 /* System call */
|
313 |
|
|
#define EXC_BP 9 /* Break point */
|
314 |
|
|
#define EXC_RI 10 /* Reserved instruction */
|
315 |
|
|
#define EXC_CPU 11 /* Coprocessor unusable */
|
316 |
|
|
#define EXC_OVF 12 /* Arithmetic overflow */
|
317 |
|
|
#define EXC_TRAP 13 /* Trap exception */
|
318 |
|
|
#define EXC_FPE 15 /* Floating Point Exception */
|
319 |
|
|
|
320 |
|
|
#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
321 |
|
|
|
322 |
|
|
#endif // ifndef CYGONCE_HAL_MIPS_REGS_H
|