1 #ifndef CYGONCE_HAL_MIPS_REGS_H
2 #define CYGONCE_HAL_MIPS_REGS_H
3 //========================================================================
7 // Register defines for MIPS processors
9 //========================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
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 version.
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //========================================================================
43 //#####DESCRIPTIONBEGIN####
45 // Author(s): Red Hat, nickg
46 // Contributors: Red Hat, nickg, dmoseley
49 // Description: Register defines for MIPS processors
52 //####DESCRIPTIONEND####
54 //========================================================================
56 #include <pkgconf/hal.h>
58 #ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
60 /* This value must agree with NUMREGS in mips-stub.h. */
62 #if defined(CYGPKG_HAL_MIPS_GDB_REPORT_CP0)
74 /* General register names for assembly code. */
77 #define at $1 /* assembler temporary */
78 #define atmp $1 /* assembler temporary */
79 #define v0 $2 /* value holders */
81 #define a0 $4 /* arguments */
85 #define t0 $8 /* temporaries */
93 #define s0 $16 /* saved registers */
101 #define t8 $24 /* temporaries */
103 #define k0 $26 /* kernel registers */
105 #define gp $28 /* global pointer */
106 #define sp $29 /* stack pointer */
107 #define s8 $30 /* saved register */
108 #define fp $30 /* frame pointer (obsolete usage) */
109 #define ra $31 /* return address */
111 /* MIPS registers, numbered in the order in which gdb expects to see them. */
191 /* System Control Coprocessor (CP0) exception processing registers */
192 #define C0_CONTEXT $4 /* Context */
193 #define C0_BADVADDR $8 /* Bad Virtual Address */
194 #define C0_COUNT $9 /* Count */
195 #define C0_COMPARE $11 /* Compare */
196 #define C0_STATUS $12 /* Processor Status */
197 #define C0_CAUSE $13 /* Exception Cause */
198 #define C0_EPC $14 /* Exception PC */
199 #define C0_WATCHLO $18 /* Watchpoint LO */
200 #define C0_WATCHHI $19 /* Watchpoint HI */
201 #define C0_XCONTEXT $20 /* XContext */
202 #define C0_ECC $26 /* ECC */
203 #define C0_CACHEERR $27 /* CacheErr */
204 #define C0_ERROREPC $30 /* ErrorEPC */
206 /* Status register fields */
207 #define SR_CUMASK 0xf0000000 /* Coprocessor usable bits */
208 #define SR_CU3 0x80000000 /* Coprocessor 3 usable */
209 #define SR_CU2 0x40000000 /* coprocessor 2 usable */
210 #define SR_CU1 0x20000000 /* Coprocessor 1 usable */
211 #define SR_CU0 0x10000000 /* Coprocessor 0 usable */
213 #define SR_FR 0x04000000 /* Enable 32 floating-point registers */
214 #define SR_RE 0x02000000 /* Reverse Endian in user mode */
216 #define SR_BEV 0x00400000 /* Bootstrap Exception Vector */
217 #define SR_TS 0x00200000 /* TLB shutdown (reserved on R4600) */
218 #define SR_SR 0x00100000 /* Soft Reset */
220 #define SR_CH 0x00040000 /* Cache Hit */
221 #define SR_CE 0x00020000 /* ECC register modifies check bits */
222 #define SR_DE 0x00010000 /* Disable cache errors */
224 #define SR_IMASK 0x0000ff00 /* Interrupt Mask */
225 #define SR_IMASK8 0x00000000 /* Interrupt Mask level=8 */
226 #define SR_IMASK7 0x00008000 /* Interrupt Mask level=7 */
227 #define SR_IMASK6 0x0000c000 /* Interrupt Mask level=6 */
228 #define SR_IMASK5 0x0000e000 /* Interrupt Mask level=5 */
229 #define SR_IMASK4 0x0000f000 /* Interrupt Mask level=4 */
230 #define SR_IMASK3 0x0000f800 /* Interrupt Mask level=3 */
231 #define SR_IMASK2 0x0000fc00 /* Interrupt Mask level=2 */
232 #define SR_IMASK1 0x0000fe00 /* Interrupt Mask level=1 */
233 #define SR_IMASK0 0x0000ff00 /* Interrupt Mask level=0 */
235 #define SR_IBIT8 0x00008000 /* (Intr5) */
236 #define SR_IBIT7 0x00004000 /* (Intr4) */
237 #define SR_IBIT6 0x00002000 /* (Intr3) */
238 #define SR_IBIT5 0x00001000 /* (Intr2) */
239 #define SR_IBIT4 0x00000800 /* (Intr1) */
240 #define SR_IBIT3 0x00000400 /* (Intr0) */
241 #define SR_IBIT2 0x00000200 /* (Software Interrupt 1) */
242 #define SR_IBIT1 0x00000100 /* (Software Interrupt 0) */
244 #define SR_KX 0x00000080 /* xtlb in kernel mode */
245 #define SR_SX 0x00000040 /* mips3 & xtlb in supervisor mode */
246 #define SR_UX 0x00000020 /* mips3 & xtlb in user mode */
248 #define SR_KSU_MASK 0x00000018 /* ksu mode mask */
249 #define SR_KSU_USER 0x00000010 /* user mode */
250 #define SR_KSU_SUPV 0x00000008 /* supervisor mode */
251 #define SR_KSU_KERN 0x00000000 /* kernel mode */
253 #define SR_ERL 0x00000004 /* error level */
254 #define SR_EXL 0x00000002 /* exception level */
255 #define SR_IE 0x00000001 /* interrupt enable */
257 /* Floating-point unit control/status register (FCR31) */
258 #define FCR31_FS 0x01000000 /* Flush denormalized to zero */
259 #define FCR31_C 0x00800000 /* FP compare result */
261 #define FCR31_CAUSE_E 0x00020000 /* Cause - unimplemented operation */
262 #define FCR31_CAUSE_V 0x00010000 /* Cause - invalid operation */
263 #define FCR31_CAUSE_Z 0x00008000 /* Cause - division by zero */
264 #define FCR31_CAUSE_O 0x00004000 /* Cause - overflow */
265 #define FCR31_CAUSE_U 0x00002000 /* Cause - underflow */
266 #define FCR31_CAUSE_I 0x00001000 /* Cause - inexact operation */
268 #define FCR31_ENABLES_V 0x00000800 /* Enables - invalid operation */
269 #define FCR31_ENABLES_Z 0x00000400 /* Enables - division by zero */
270 #define FCR31_ENABLES_O 0x00000200 /* Enables - overflow */
271 #define FCR31_ENABLES_U 0x00000100 /* Enables - underflow */
272 #define FCR31_ENABLES_I 0x00000080 /* Enables - inexact operation */
274 #define FCR31_FLAGS_V 0x00000040 /* Flags - invalid operation */
275 #define FCR31_FLAGS_Z 0x00000020 /* Flags - division by zero */
276 #define FCR31_FLAGS_O 0x00000010 /* Flags - overflow */
277 #define FCR31_FLAGS_U 0x00000008 /* Flags - underflow */
278 #define FCR31_FLAGS_I 0x00000004 /* Flags - inexact operation */
280 #define FCR31_RMMASK 0x00000002 /* Rounding mode mask */
281 #define FCR31_RM_RN 0 /* Round to nearest */
282 #define FCR31_RM_RZ 1 /* Round to zero */
283 #define FCR31_RM_RP 2 /* Round to +infinity */
284 #define FCR31_RM_RM 3 /* Round to -infinity */
287 /* Cause register fields */
288 #define CAUSE_BD 0x80000000 /* Branch Delay */
289 #define CAUSE_CEMASK 0x30000000 /* Coprocessor Error */
290 #define CAUSE_CESHIFT 28 /* Right justify CE */
291 #define CAUSE_IPMASK 0x0000ff00 /* Interrupt Pending */
292 #define CAUSE_IPSHIFT 8 /* Right justify IP */
293 #define CAUSE_IP8 0x00008000 /* (Intr5) */
294 #define CAUSE_IP7 0x00004000 /* (Intr4) */
295 #define CAUSE_IP6 0x00002000 /* (Intr3) */
296 #define CAUSE_IP5 0x00001000 /* (Intr2) */
297 #define CAUSE_IP4 0x00000800 /* (Intr1) */
298 #define CAUSE_IP3 0x00000400 /* (Intr0) */
299 #define CAUSE_SW2 0x00000200 /* (Software Interrupt 1) */
300 #define CAUSE_SW1 0x00000100 /* (Software Interrupt 0) */
301 #define CAUSE_EXCMASK 0x0000007c /* Exception Code */
302 #define CAUSE_EXCSHIFT 2 /* Right justify EXC */
304 /* Exception Codes */
305 #define EXC_INT 0 /* External interrupt */
306 #define EXC_MOD 1 /* TLB modification exception */
307 #define EXC_TLBL 2 /* TLB miss (Load or Ifetch) */
308 #define EXC_TLBS 3 /* TLB miss (Store) */
309 #define EXC_ADEL 4 /* Address error (Load or Ifetch) */
310 #define EXC_ADES 5 /* Address error (Store) */
311 #define EXC_IBE 6 /* Bus error (Ifetch) */
312 #define EXC_DBE 7 /* Bus error (data load or store) */
313 #define EXC_SYS 8 /* System call */
314 #define EXC_BP 9 /* Break point */
315 #define EXC_RI 10 /* Reserved instruction */
316 #define EXC_CPU 11 /* Coprocessor unusable */
317 #define EXC_OVF 12 /* Arithmetic overflow */
318 #define EXC_TRAP 13 /* Trap exception */
319 #define EXC_FPE 15 /* Floating Point Exception */
321 #endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
323 #endif // ifndef CYGONCE_HAL_MIPS_REGS_H