source: rtems/cpukit/score/include/rtems/score/context.h @ d4dc7c8

4.115
Last change on this file since d4dc7c8 was 06dcaf0, checked in by Joel Sherrill <joel.sherrill@…>, on 03/16/11 at 20:05:06

2011-03-16 Jennifer Averett <jennifer.averett@…>

PR 1729/cpukit

  • configure.ac, sapi/include/confdefs.h, sapi/src/exinit.c, score/Makefile.am, score/preinstall.am, score/cpu/i386/rtems/score/cpu.h, score/cpu/sparc/cpu_asm.S, score/cpu/sparc/rtems/score/cpu.h, score/include/rtems/score/basedefs.h, score/include/rtems/score/context.h, score/include/rtems/score/percpu.h, score/src/percpu.c, score/src/thread.c, score/src/threadcreateidle.c: Add next step in SMP support. This adds an allocated array of the Per_CPU structures to support multiple cpus vs a single instance of the structure which is still used if SMP support is disabled. Configuration support is also added to explicitly enable or disable SMP. But SMP can only be enabled for the CPUs which will support it initially -- SPARC and i386. With the stub BSP support, a BSP can be run as a single core SMP system from an RTEMS data structure standpoint.
  • aclocal/check-smp.m4, aclocal/enable-smp.m4, score/include/rtems/bspsmp.h, score/include/rtems/score/smplock.h, score/src/smp.c, score/src/smplock.c: New files.
  • Property mode set to 100644
File size: 5.2 KB
Line 
1/**
2 *  @file  rtems/score/context.h
3 *
4 *  This include file contains all information about each thread's context.
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17
18#ifndef _RTEMS_SCORE_CONTEXT_H
19#define _RTEMS_SCORE_CONTEXT_H
20
21/**
22 *  @defgroup ScoreContext Context Handler
23 *
24 *  This handler encapsulates functionality which abstracts thread context
25 *  management in a portable manner.
26 *
27 *  The context switch needed variable is contained in the per cpu
28 *  data structure.
29 */
30/**@{*/
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include <rtems/score/cpu.h>
37
38/**
39 *  @brief Size of Floating Point Context Area
40 *
41 *  This constant defines the number of bytes required
42 *  to store a full floating point context.
43 */
44#define CONTEXT_FP_SIZE CPU_CONTEXT_FP_SIZE
45
46/**
47 *  @brief Initialize Context Area
48 *
49 *  This routine initializes @a _the_context such that the stack
50 *  pointer, interrupt level, and entry point are correct for the
51 *  thread's initial state.
52 *
53 *  @param[in] _the_context will be initialized
54 *  @param[in] _stack is the lowest physical address of the thread's
55 *         context
56 *  @param[in] _size is the size in octets of the thread's context
57 *  @param[in] _isr is the ISR enable level for this thread
58 *  @param[in] _entry is this thread's entry point
59 *  @param[in] _is_fp is set to true if this thread has floating point
60 *         enabled
61 */
62#define _Context_Initialize(_the_context, _stack, _size, _isr, _entry, _is_fp) \
63   _CPU_Context_Initialize( _the_context, _stack, _size, _isr, _entry, _is_fp )
64
65/**
66 *  This macro is invoked from _Thread_Handler to do whatever CPU
67 *  specific magic is required that must be done in the context of
68 *  the thread when it starts.
69 *
70 *  If the CPU architecture does not require any magic, then this
71 *  macro is empty.
72 */
73
74#if defined(_CPU_Context_Initialization_at_thread_begin)
75  #define _Context_Initialization_at_thread_begin() \
76     _CPU_Context_Initialization_at_thread_begin()
77#else
78  #define _Context_Initialization_at_thread_begin()
79#endif
80
81/**
82 *  @brief Perform Context Switch
83 *
84 *  This routine saves the current context into the @a _executing
85 *  context record and restores the context specified by @a _heir.
86 *
87 *  @param[in] _executing is the currently executing thread's context
88 *  @param[in] _heir is the context of the thread to be switched to
89 */
90#define _Context_Switch( _executing, _heir ) \
91   _CPU_Context_switch( _executing, _heir )
92
93/**
94 *  @brief Restart Currently Executing Thread
95 *
96 *  This routine restarts the calling thread by restoring its initial
97 *  stack pointer and returning to the thread's entry point.
98 *
99 *  @param[in] _the_context is the context of the thread to restart
100 */
101#define _Context_Restart_self( _the_context ) \
102   _CPU_Context_Restart_self( _the_context )
103
104#if defined(RTEMS_SMP)
105/*
106 *  @brief Switch to First Task on Secondary Core
107 *
108 *  This routine is only used to switch to the first task on a
109 *  secondary core in an SMP configuration.  Since the switch
110 *  to the first task is done from an interrupt handler, this
111 *  may be different from simply restarting the currently running
112 *  task.
113 *
114 *  @param[in] _the_context is the context of the first thread to
115 *             run on this core
116 */
117#define _Context_Switch_to_first_task_smp( _the_context ) \
118   _CPU_Context_switch_to_first_task_smp( _the_context )
119#endif
120
121/**
122 *  @brief Return Starting Address of Floating Point Context
123 *
124 *  This function returns the starting address of the floating
125 *  point context save area.  It is assumed that the are reserved
126 *  for the floating point save area is large enough.
127 *
128 *  @param[in] _base is lowest physical address of the floating point
129 *         context save area.
130 *  @param[in] _offset is the offset into the floating point area
131 *
132 *  @return the initial FP context pointer
133 */
134#define _Context_Fp_start( _base, _offset ) \
135   _CPU_Context_Fp_start( (_base), (_offset) )
136
137/**
138 *  @brief Initialize Floating Point Context Area
139 *
140 *  This routine initializes the floating point context save
141 *  area to contain an initial known state.
142 *
143 *  @param[in] _fp_area is the base address of the floating point
144 *         context save area to initialize.
145 */
146#define _Context_Initialize_fp( _fp_area ) \
147   _CPU_Context_Initialize_fp( _fp_area )
148
149/**
150 *  @brief Restore Floating Point Context Area
151 *
152 *  This routine restores the floating point context contained
153 *  in the @a _fp area.  It is assumed that the current
154 *  floating point context has been saved by a previous invocation
155 *  of @a _Context_Save_fp.
156 *
157 *  @param[in] _fp points to the floating point context area to restore.
158 */
159#define _Context_Restore_fp( _fp ) \
160   _CPU_Context_restore_fp( _fp )
161
162/**
163 *  @brief Save Floating Point Context Area
164 *
165 *  This routine saves the current floating point context
166 *  in the @a _fp area.
167 *
168 *  @param[in] _fp points to the floating point context area to restore.
169 */
170#define _Context_Save_fp( _fp ) \
171   _CPU_Context_save_fp( _fp )
172
173#ifdef __cplusplus
174}
175#endif
176
177/**@}*/
178
179#endif
180/* end of include file */
Note: See TracBrowser for help on using the repository browser.