OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mips/] [arch/] [v2_0/] [include/] [mips-regs.h] - Blame information for rev 638

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#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 Red Hat, 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 version.
18
//
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
22
// for more details.
23
//
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.
27
//
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.
34
//
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.
37
//
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####
44
//
45
// Author(s):     Red Hat, nickg
46
// Contributors:  Red Hat, nickg, dmoseley
47
// Date:          1998-06-08
48
// Purpose:       
49
// Description:   Register defines for MIPS processors
50
// Usage:         
51
//
52
//####DESCRIPTIONEND####
53
//
54
//========================================================================
55
 
56
#include <pkgconf/hal.h>
57
 
58
#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
59
 
60
/* This value must agree with NUMREGS in mips-stub.h. */
61
 
62
#if defined(CYGPKG_HAL_MIPS_GDB_REPORT_CP0)
63
#define NUM_REGS   107
64
#else
65
#define NUM_REGS    90
66
#endif
67
 
68
#ifdef __mips64
69
  #define REG_SIZE 8
70
#else
71
  #define REG_SIZE 4
72
#endif
73
 
74
/* General register names for assembly code. */
75
 
76
#define zero            $0
77
#define at              $1              /* assembler temporary */
78
#define atmp            $1              /* assembler temporary */
79
#define v0              $2              /* value holders */
80
#define v1              $3
81
#define a0              $4              /* arguments */
82
#define a1              $5
83
#define a2              $6
84
#define a3              $7
85
#define t0              $8              /* temporaries */
86
#define t1              $9
87
#define t2              $10
88
#define t3              $11
89
#define t4              $12
90
#define t5              $13
91
#define t6              $14
92
#define t7              $15
93
#define s0              $16             /* saved registers */
94
#define s1              $17
95
#define s2              $18
96
#define s3              $19
97
#define s4              $20
98
#define s5              $21
99
#define s6              $22
100
#define s7              $23
101
#define t8              $24             /* temporaries */
102
#define t9              $25
103
#define k0              $26             /* kernel registers */
104
#define k1              $27
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 */
110
 
111
/* MIPS registers, numbered in the order in which gdb expects to see them. */
112
#define ZERO            0
113
#define AT              1
114
#define ATMP            1
115
#define V0              2
116
#define V1              3
117
#define A0              4
118
#define A1              5
119
#define A2              6
120
#define A3              7
121
 
122
#define T0              8
123
#define T1              9
124
#define T2              10
125
#define T3              11
126
#define T4              12
127
#define T5              13
128
#define T6              14
129
#define T7              15
130
 
131
#define S0              16
132
#define S1              17
133
#define S2              18
134
#define S3              19
135
#define S4              20
136
#define S5              21
137
#define S6              22
138
#define S7              23
139
 
140
#define T8              24
141
#define T9              25
142
#define K0              26
143
#define K1              27
144
#define GP              28
145
#define SP              29
146
#define S8              30
147
#define RA              31
148
 
149
#define SR              32
150
#define LO              33
151
#define HI              34
152
#define BAD_VA          35
153
#define CAUSE           36
154
#define PC              37
155
 
156
#define F0              38
157
#define F1              39
158
#define F2              40
159
#define F3              41
160
#define F4              42
161
#define F5              43
162
#define F6              44
163
#define F7              45
164
#define F8              46
165
#define F9              47
166
#define F10             48
167
#define F11             49
168
#define F12             50
169
#define F13             51
170
#define F14             52
171
#define F15             53
172
#define F16             54
173
#define F17             55
174
#define F18             56
175
#define F19             57
176
#define F20             58
177
#define F21             59
178
#define F22             60
179
#define F23             61
180
#define F24             62
181
#define F25             63
182
#define F26             64
183
#define F27             65
184
#define F28             66
185
#define F29             67
186
#define F30             68
187
#define F31             69
188
 
189
#define FCR31           70
190
 
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 */
205
 
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 */
212
 
213
#define SR_FR           0x04000000      /* Enable 32 floating-point registers */
214
#define SR_RE           0x02000000      /* Reverse Endian in user mode */
215
 
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 */
219
 
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 */
223
 
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 */
234
 
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) */
243
 
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 */
247
 
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 */
252
 
253
#define SR_ERL          0x00000004      /* error level */
254
#define SR_EXL          0x00000002      /* exception level */
255
#define SR_IE           0x00000001      /* interrupt enable */
256
 
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 */
260
 
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 */
267
 
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 */
273
 
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 */
279
 
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 */
285
 
286
 
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 */
303
 
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 */
320
 
321
#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
322
 
323
#endif // ifndef CYGONCE_HAL_MIPS_REGS_H

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.