source: rtems/c/src/exec/score/cpu/mips/rtems/score/mips.h @ 6937dfd6

4.104.114.84.95
Last change on this file since 6937dfd6 was 6937dfd6, checked in by Joel Sherrill <joel.sherrill@…>, on 05/24/01 at 19:49:31

2000-05-24 Joel Sherrill <joel@…>

  • rtems/score/mips.h: Added constants for MIPS exception numbers. All exceptions should be given low numbers and thus can be installed and processed in a uniform manner. Variances between various MIPS ISA levels were not accounted for.
  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*  mips.h
2 *
3 *  COPYRIGHT (c) 1989-2001.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.OARcorp.com/rtems/license.html.
9 *
10 *  $Id$
11 */
12/* @(#)mips64orion.h       08/29/96     1.3 */
13
14#ifndef _INCLUDE_MIPS_h
15#define _INCLUDE_MIPS_h
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#ifndef ASM
22#include <idtcpu.h>
23#endif
24
25/*
26 *  SR bits that enable/disable interrupts
27 *
28 *  NOTE: XXX what about SR_ERL?
29 */
30
31#if __mips == 3
32#ifdef ASM
33#define SR_INTERRUPT_ENABLE_BITS 0x01
34#else
35#define SR_INTERRUPT_ENABLE_BITS SR_IE
36#endif
37
38#elif __mips == 1
39#define SR_INTERRUPT_ENABLE_BITS SR_IEC
40
41#else
42#error "mips interrupt enable bits: unknown architecture level!"
43#endif
44
45/*
46 *  This file contains the information required to build
47 *  RTEMS for a particular member of the "no cpu"
48 *  family when executing in protected mode.  It does
49 *  this by setting variables to indicate which implementation
50 *  dependent features are present in a particular member
51 *  of the family.
52 */
53 
54#if defined(__mips_soft_float)
55#define MIPS_HAS_FPU 0
56#else
57#define MIPS_HAS_FPU 1
58#endif
59
60#if (__mips == 1)
61#define CPU_MODEL_NAME  "ISA Level 1 or 2"
62#elif (__mips == 3)
63#if defined(__mips64)
64#define CPU_MODEL_NAME  "ISA Level 4"
65#else
66#define CPU_MODEL_NAME  "ISA Level 3"
67#endif
68#else
69#error "Unknown MIPS ISA level"
70#endif
71
72/*
73 *  Define the name of the CPU family.
74 */
75
76#define CPU_NAME "MIPS"
77
78/*
79 *  RTEMS Vector numbers for exception conditions.  This is a direct
80 *  map to the causes.
81 */
82
83#define MIPS_EXCEPTION_BASE 0
84
85#define MIPS_EXCEPTION_INT              MIPS_EXCEPTION_BASE+0
86#define MIPS_EXCEPTION_MOD              MIPS_EXCEPTION_BASE+1
87#define MIPS_EXCEPTION_TLBL             MIPS_EXCEPTION_BASE+2
88#define MIPS_EXCEPTION_TLBS             MIPS_EXCEPTION_BASE+3
89#define MIPS_EXCEPTION_ADEL             MIPS_EXCEPTION_BASE+4
90#define MIPS_EXCEPTION_ADES             MIPS_EXCEPTION_BASE+5
91#define MIPS_EXCEPTION_IBE              MIPS_EXCEPTION_BASE+6
92#define MIPS_EXCEPTION_DBE              MIPS_EXCEPTION_BASE+7
93#define MIPS_EXCEPTION_SYSCALL          MIPS_EXCEPTION_BASE+8
94#define MIPS_EXCEPTION_BREAK            MIPS_EXCEPTION_BASE+9
95#define MIPS_EXCEPTION_RI               MIPS_EXCEPTION_BASE+10
96#define MIPS_EXCEPTION_CPU              MIPS_EXCEPTION_BASE+11
97#define MIPS_EXCEPTION_OVERFLOW         MIPS_EXCEPTION_BASE+12
98#define MIPS_EXCEPTION_TRAP             MIPS_EXCEPTION_BASE+13
99#define MIPS_EXCEPTION_VCEI             MIPS_EXCEPTION_BASE+14
100/* FPE only on mips2 and higher */
101#define MIPS_EXCEPTION_FPE              MIPS_EXCEPTION_BASE+15
102#define MIPS_EXCEPTION_C2E              MIPS_EXCEPTION_BASE+16
103/* 17-22 reserved */
104#define MIPS_EXCEPTION_WATCH            MIPS_EXCEPTION_BASE+23
105/* 24-30 reserved */
106#define MIPS_EXCEPTION_VCED             MIPS_EXCEPTION_BASE+31
107
108#define MIPS_INTERRUPT_BASE             MIPS_EXCEPTION_BASE+32
109
110/*
111 *  Some macros to access registers
112 */
113
114#define mips_get_sr( _x ) \
115  do { \
116    asm volatile( "mfc0 %0, $12; nop" : "=r" (_x) : ); \
117  } while (0)
118
119#define mips_set_sr( _x ) \
120  do { \
121    register unsigned int __x = (_x); \
122    asm volatile( "mtc0 %0, $12; nop" : : "r" (__x) ); \
123  } while (0)
124
125
126/*
127 *  Access the Cause register
128 */
129
130#define mips_get_cause( _x ) \
131  do { \
132    asm volatile( "mfc0 %0, $13; nop" : "=r" (_x) : ); \
133  } while (0)
134
135
136#define mips_set_cause( _x ) \
137  do { \
138    register unsigned int __x = (_x); \
139    asm volatile( "mtc0 %0, $13; nop" : : "r" (__x) ); \
140  } while (0)
141
142
143/*
144 *  Access FCR31
145 */
146
147#define mips_get_fcr31( _x ) \
148  do { \
149    asm volatile( "cfc1 %0, $31; nop" : "=r" (_x) : ); \
150  } while(0)
151
152
153#define mips_set_fcr31( _x ) \
154  do { \
155    register unsigned int __x = (_x); \
156    asm volatile( "ctc1 %0, $31; nop" : : "r" (__x) ); \
157  } while(0)
158
159
160/*
161 *  Manipulate interrupt mask
162 *
163 *  mips_unmask_interrupt( _mask)
164 *    enables interrupts - mask is positioned so it only needs to be or'ed
165 *    into the status reg. This also does some other things !!!! Caution
166 *    should be used if invoking this while in the middle of a debugging
167 *    session where the client may have nested interrupts.
168 *
169 *  mips_mask_interrupt( _mask )
170 *    disable the interrupt - mask is the complement of the bits to be
171 *    cleared - i.e. to clear ext int 5 the mask would be - 0xffff7fff
172 *
173 *
174 *  NOTE: mips_mask_interrupt() used to be disable_int().
175 *        mips_unmask_interrupt() used to be enable_int().
176 *
177 */
178
179#define mips_enable_in_interrupt_mask( _mask ) \
180  do { \
181    unsigned int _sr; \
182    mips_get_sr( _sr ); \
183    _sr |= (_mask); \
184    mips_set_sr( _sr ); \
185  } while (0)
186
187#define mips_disable_in_interrupt_mask( _mask ) \
188  do { \
189    unsigned int _sr; \
190    mips_get_sr( _sr ); \
191    _sr &= ~(_mask); \
192    mips_set_sr( _sr ); \
193  } while (0)
194
195#ifdef __cplusplus
196}
197#endif
198
199#endif /* ! _INCLUDE_MIPS_h */
200/* end of include file */
Note: See TracBrowser for help on using the repository browser.