source: rtems/c/src/exec/score/cpu/mips/cpu.c @ 0ef748fb

4.104.114.84.95
Last change on this file since 0ef748fb was fda47cd, checked in by Joel Sherrill <joel.sherrill@…>, on 10/24/00 at 21:48:33

2000-10-24 Alan Cudmore <alanc@…> and

Joel Sherrill <joel@…>

  • This is a major reworking of the mips64orion port to use gcc predefines as much as possible and a big push to multilib the mips port. The mips64orion port was copied/renamed to mips to be more like other GNU tools. Alan did most of the technical work of determining how to map old macro names used by the mips64orion port to standard compiler macro definitions. Joel did the merge with CVS magic to keep individual file history and did the BSP modifications. Details follow:
  • Makefile.am: idtmon.h in mips64orion port not present.
  • asm.h: MIPS64ORION replaced with MIPS. Frame setup macros added.
  • cpu.c: Comments added.
  • cpu_asm.S: Conditionals changed. MIPS ISA level 1 support added. First attempt at exception/interrupt processing for ISA level 1 and minus any use of IDT/MON added.
  • idtcpu.h: Conditionals changed to use gcc predefines.
  • iregdef.h: Ditto.
  • cpu_asm.h: No real change. Merger required commit.
  • rtems/Makefile.am: Ditto.
  • rtems/score/Makefile.am: Ditto.
  • rtems/score/cpu.h: Change MIPS64ORION to MIPS.
  • rtems/score/mips64orion.h: Change MIPS64ORION to MIPS. Convert from using RTEMS_CPU_MODEL to gcc predefines to figre things out.
  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 *  Mips CPU Dependent Source
3 *
4 *  Conversion to MIPS port by Alan Cudmore <alanc@linuxstart.com> and
5 *           Joel Sherrill <joel@OARcorp.com>.
6 *
7 *  Original MIP64ORION port by Craig Lebakken <craigl@transition.com>
8 *           COPYRIGHT (c) 1996 by Transition Networks Inc.
9 *
10 *         To anyone who acknowledges that this file is provided "AS IS"
11 *         without any express or implied warranty:
12 *             permission to use, copy, modify, and distribute this file
13 *             for any purpose is hereby granted without fee, provided that
14 *             the above copyright notice and this notice appears in all
15 *             copies, and that the name of Transition Networks not be used in
16 *             advertising or publicity pertaining to distribution of the
17 *             software without specific, written prior permission.
18 *             Transition Networks makes no representations about the
19 *             suitability of this software for any purpose.
20 *
21 *  Derived from c/src/exec/score/cpu/no_cpu/cpu.c:
22 *
23 *  COPYRIGHT (c) 1989-1999.
24 *  On-Line Applications Research Corporation (OAR).
25 *
26 *  The license and distribution terms for this file may be
27 *  found in the file LICENSE in this distribution or at
28 *  http://www.OARcorp.com/rtems/license.html.
29 *
30 *  $Id$
31 */
32
33/*
34 *  Rather than deleting this, it is commented out to (hopefully) help
35 *  the submitter send updates.
36 *
37 * static char _sccsid[] = "@(#)cpu.c 08/20/96     1.5\n";
38 */
39
40#include <rtems/system.h>
41#include <rtems/score/isr.h>
42#include <rtems/score/wkspace.h>
43
44
45ISR_Handler_entry _ISR_Vector_table[ ISR_NUMBER_OF_VECTORS ];
46
47/*  _CPU_Initialize
48 *
49 *  This routine performs processor dependent initialization.
50 *
51 *  INPUT PARAMETERS:
52 *    cpu_table       - CPU table to initialize
53 *    thread_dispatch - address of disptaching routine
54 */
55
56
57void null_handler( void )
58{
59}
60
61
62void _CPU_Initialize(
63  rtems_cpu_table  *cpu_table,
64  void      (*thread_dispatch)      /* ignored on this CPU */
65)
66{
67   unsigned int i = ISR_NUMBER_OF_VECTORS;
68
69   while ( i-- )
70   {
71      _ISR_Vector_table[i] = (ISR_Handler_entry)null_handler;
72   }
73
74  /*
75   *  The thread_dispatch argument is the address of the entry point
76   *  for the routine called at the end of an ISR once it has been
77   *  decided a context switch is necessary.  On some compilation
78   *  systems it is difficult to call a high-level language routine
79   *  from assembly.  This allows us to trick these systems.
80   *
81   *  If you encounter this problem save the entry point in a CPU
82   *  dependent variable.
83   */
84
85  _CPU_Thread_dispatch_pointer = thread_dispatch;
86
87  /*
88   *  If there is not an easy way to initialize the FP context
89   *  during Context_Initialize, then it is usually easier to
90   *  save an "uninitialized" FP context here and copy it to
91   *  the task's during Context_Initialize.
92   */
93
94  /* FP context initialization support goes here */
95
96  _CPU_Table = *cpu_table;
97
98}
99
100/*PAGE
101 *
102 *  _CPU_ISR_Get_level
103 */
104 
105#if 0 /* located in cpu_asm.S */
106unsigned32 _CPU_ISR_Get_level( void )
107{
108  /*
109   *  This routine returns the current interrupt level.
110   */
111}
112#endif
113
114/*PAGE
115 *
116 *  _CPU_ISR_install_raw_handler
117 */
118 
119void _CPU_ISR_install_raw_handler(
120  unsigned32  vector,
121  proc_ptr    new_handler,
122  proc_ptr   *old_handler
123)
124{
125  /*
126   *  This is where we install the interrupt handler into the "raw" interrupt
127   *  table used by the CPU to dispatch interrupt handlers.
128   */
129/* Q: This will become necessary for Non IDT/Sim use...*/
130#if 0 /* not necessary */
131/* use IDT/Sim to set interrupt vector.  Needed to co-exist with debugger. */
132   add_ext_int_func( vector, new_handler );
133#endif
134}
135
136/*PAGE
137 *
138 *  _CPU_ISR_install_vector
139 *
140 *  This kernel routine installs the RTEMS handler for the
141 *  specified vector.
142 *
143 *  Input parameters:
144 *    vector      - interrupt vector number
145 *    old_handler - former ISR for this vector number
146 *    new_handler - replacement ISR for this vector number
147 *
148 *  Output parameters:  NONE
149 *
150 */
151
152void _CPU_ISR_install_vector(
153  unsigned32  vector,
154  proc_ptr    new_handler,
155  proc_ptr   *old_handler
156)
157{
158   *old_handler = _ISR_Vector_table[ vector ];
159
160   /*
161    *  If the interrupt vector table is a table of pointer to isr entry
162    *  points, then we need to install the appropriate RTEMS interrupt
163    *  handler for this vector number.
164    */
165
166   _CPU_ISR_install_raw_handler( vector, _ISR_Handler, old_handler );
167
168   /*
169    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
170    *  be used by the _ISR_Handler so the user gets control.
171    */
172
173    _ISR_Vector_table[ vector ] = new_handler;
174}
175
176/*PAGE
177 *
178 *  _CPU_Install_interrupt_stack
179 */
180
181void _CPU_Install_interrupt_stack( void )
182{
183/* we don't support this yet */
184}
185
186/*PAGE
187 *
188 *  _CPU_Internal_threads_Idle_thread_body
189 *
190 *  NOTES:
191 *
192 *  1. This is the same as the regular CPU independent algorithm.
193 *
194 *  2. If you implement this using a "halt", "idle", or "shutdown"
195 *     instruction, then don't forget to put it in an infinite loop.
196 *
197 *  3. Be warned. Some processors with onboard DMA have been known
198 *     to stop the DMA if the CPU were put in IDLE mode.  This might
199 *     also be a problem with other on-chip peripherals.  So use this
200 *     hook with caution.
201 */
202
203#if 0 /* located in cpu_asm.S */
204void _CPU_Thread_Idle_body( void )
205{
206
207  for( ; ; )
208    /* insert your "halt" instruction here */ ;
209}
210#endif
211
212extern void mips_break( int error );
213
214#include <stdio.h>
215
216void mips_fatal_error( int error )
217{
218   printf("fatal error 0x%x %d\n",error,error);
219   mips_break( error );
220}
Note: See TracBrowser for help on using the repository browser.