source: rtems-schedsim/schedsim/rtems/sched_cpu/cpu_asm.c @ a2aad55

Last change on this file since a2aad55 was a2aad55, checked in by Joel Sherrill <joel.sherrill@…>, on 05/01/13 at 00:41:56

Remove CVS $

  • Property mode set to 100644
File size: 5.4 KB
RevLine 
[abb18dc]1/*  cpu_asm.c  ===> cpu_asm.S or cpu_asm.s
2 *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
3 *
4 *
5 *  This file contains the basic algorithms for all assembly code used
6 *  in an specific CPU port of RTEMS.  These algorithms must be implemented
7 *  in assembly language
8 *
9 *  NOTE:  This is supposed to be a .S or .s file NOT a C file.
10 *
[a2aad55]11 *  COPYRIGHT (c) 1989-2013.
[abb18dc]12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19/*
20 *  This is supposed to be an assembly file.  This means that system.h
21 *  and cpu.h should not be included in a "real" cpu_asm file.  An
22 *  implementation in assembly should include "cpu_asm.h>
23 */
24
25#ifdef HAVE_CONFIG_H
26#include "config.h"
27#endif
28
29#include <rtems/system.h>
30#include <rtems/score/cpu.h>
31/* #include "cpu_asm.h> */
32
33/*
34 *  _CPU_Context_save_fp_context
35 *
36 *  This routine is responsible for saving the FP context
37 *  at *fp_context_ptr.  If the point to load the FP context
38 *  from is changed then the pointer is modified by this routine.
39 *
40 *  Sometimes a macro implementation of this is in cpu.h which dereferences
41 *  the ** and a similarly named routine in this file is passed something
42 *  like a (Context_Control_fp *).  The general rule on making this decision
43 *  is to avoid writing assembly language.
44 *
45 *  NO_CPU Specific Information:
46 *
47 *  XXX document implementation including references if appropriate
48 */
49
50void _CPU_Context_save_fp(
51  Context_Control_fp **fp_context_ptr
52)
53{
54}
55
56/*
57 *  _CPU_Context_restore_fp_context
58 *
59 *  This routine is responsible for restoring the FP context
60 *  at *fp_context_ptr.  If the point to load the FP context
61 *  from is changed then the pointer is modified by this routine.
62 *
63 *  Sometimes a macro implementation of this is in cpu.h which dereferences
64 *  the ** and a similarly named routine in this file is passed something
65 *  like a (Context_Control_fp *).  The general rule on making this decision
66 *  is to avoid writing assembly language.
67 *
68 *  NO_CPU Specific Information:
69 *
70 *  XXX document implementation including references if appropriate
71 */
72
73void _CPU_Context_restore_fp(
74  Context_Control_fp **fp_context_ptr
75)
76{
77}
78
79/*  _CPU_Context_switch
80 *
81 *  This routine performs a normal non-FP context switch.
82 *
83 *  NO_CPU Specific Information:
84 *
85 *  XXX document implementation including references if appropriate
86 */
87
88void _CPU_Context_switch(
89  Context_Control  *run,
90  Context_Control  *heir
91)
92{
93}
94
95/*
96 *  _CPU_Context_restore
97 *
98 *  This routine is generally used only to restart self in an
99 *  efficient manner.  It may simply be a label in _CPU_Context_switch.
100 *
101 *  NOTE: May be unnecessary to reload some registers.
102 *
103 *  NO_CPU Specific Information:
104 *
105 *  XXX document implementation including references if appropriate
106 */
107
108void _CPU_Context_restore(
109  Context_Control *new_context
110)
111{
112}
113
114/*  void __ISR_Handler()
115 *
116 *  This routine provides the RTEMS interrupt management.
117 *
118 *  NO_CPU Specific Information:
119 *
120 *  XXX document implementation including references if appropriate
121 */
122
123void _ISR_Handler(void)
124{
125   /*
126    *  This discussion ignores a lot of the ugly details in a real
127    *  implementation such as saving enough registers/state to be
128    *  able to do something real.  Keep in mind that the goal is
129    *  to invoke a user's ISR handler which is written in C and
130    *  uses a certain set of registers.
131    *
132    *  Also note that the exact order is to a large extent flexible.
133    *  Hardware will dictate a sequence for a certain subset of
134    *  _ISR_Handler while requirements for setting
135    */
136
137  /*
138   *  At entry to "common" _ISR_Handler, the vector number must be
139   *  available.  On some CPUs the hardware puts either the vector
140   *  number or the offset into the vector table for this ISR in a
141   *  known place.  If the hardware does not give us this information,
142   *  then the assembly portion of RTEMS for this port will contain
143   *  a set of distinct interrupt entry points which somehow place
144   *  the vector number in a known place (which is safe if another
145   *  interrupt nests this one) and branches to _ISR_Handler.
146   *
147   *  save some or all context on stack
148   *  may need to save some special interrupt information for exit
149   *
150   *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
151   *    if ( _ISR_Nest_level == 0 )
152   *      switch to software interrupt stack
153   *  #endif
154   *
155   *  _ISR_Nest_level++;
156   *
157   *  _Thread_Dispatch_disable_level++;
158   *
159   *  (*_ISR_Vector_table[ vector ])( vector );
160   *
161   *  _Thread_Dispatch_disable_level--;
162   *
163   *  --_ISR_Nest_level;
164   *
165   *  if ( _ISR_Nest_level )
166   *    goto the label "exit interrupt (simple case)"
167   *
168   *  if ( _Thread_Dispatch_disable_level )
169   *    _ISR_Signals_to_thread_executing = FALSE;
170   *    goto the label "exit interrupt (simple case)"
171   *
172   *  if ( _Context_Switch_necessary || _ISR_Signals_to_thread_executing ) {
173   *    _ISR_Signals_to_thread_executing = FALSE;
174   *    call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
175   *    prepare to get out of interrupt
176   *    return from interrupt  (maybe to _ISR_Dispatch)
177   *
178   *  LABEL "exit interrupt (simple case):
179   *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
180   *    if outermost interrupt
181   *      restore stack
182   *  #endif
183   *  prepare to get out of interrupt
184   *  return from interrupt
185   */
186}
Note: See TracBrowser for help on using the repository browser.