1 | /* context.h |
---|
2 | * |
---|
3 | * This include file contains all information about a context. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * All rights assigned to U.S. Government, 1994. |
---|
8 | * |
---|
9 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
10 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
11 | * notice must appear in all copies of this file and its derivatives. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __RTEMS_CONTEXT_h |
---|
17 | #define __RTEMS_CONTEXT_h |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <rtems/score/cpu.h> |
---|
24 | |
---|
25 | /* |
---|
26 | * The following constant defines the number of bytes required |
---|
27 | * to store a full floating point context. |
---|
28 | */ |
---|
29 | |
---|
30 | #define CONTEXT_FP_SIZE CPU_CONTEXT_FP_SIZE |
---|
31 | |
---|
32 | /* |
---|
33 | * The following variable is set to TRUE when a reschedule operation |
---|
34 | * has determined that the processor should be taken away from the |
---|
35 | * currently executing thread and given to the heir thread. |
---|
36 | */ |
---|
37 | |
---|
38 | EXTERN boolean _Context_Switch_necessary; |
---|
39 | |
---|
40 | /* |
---|
41 | * _Context_Initialize |
---|
42 | * |
---|
43 | * DESCRIPTION: |
---|
44 | * |
---|
45 | * This routine initializes THE_CONTEXT such that the stack |
---|
46 | * pointer, interrupt level, and entry point are correct for the |
---|
47 | * thread's initial state. |
---|
48 | */ |
---|
49 | |
---|
50 | #define _Context_Initialize( _the_context, _stack, _size, _isr, _entry ) \ |
---|
51 | _CPU_Context_Initialize( _the_context, _stack, _size, _isr, _entry ) |
---|
52 | |
---|
53 | /* |
---|
54 | * _Context_Switch |
---|
55 | * |
---|
56 | * DESCRIPTION: |
---|
57 | * |
---|
58 | * This routine saves the current context into the EXECUTING |
---|
59 | * context record and restores the context specified by HEIR. |
---|
60 | */ |
---|
61 | |
---|
62 | #define _Context_Switch( _executing, _heir ) \ |
---|
63 | _CPU_Context_switch( _executing, _heir ) |
---|
64 | |
---|
65 | /* |
---|
66 | * _Context_Restart_self |
---|
67 | * |
---|
68 | * DESCRIPTION: |
---|
69 | * |
---|
70 | * This routine restarts the calling thread by restoring its initial |
---|
71 | * stack pointer and returning to the thread's entry point. |
---|
72 | */ |
---|
73 | |
---|
74 | #define _Context_Restart_self( _the_context ) \ |
---|
75 | _CPU_Context_Restart_self( _the_context ) |
---|
76 | |
---|
77 | /* |
---|
78 | * _Context_Fp_start |
---|
79 | * |
---|
80 | * DESCRIPTION: |
---|
81 | * |
---|
82 | * This function returns the starting address of the floating |
---|
83 | * point context save area. It is assumed that the are reserved |
---|
84 | * for the floating point save area is large enough. |
---|
85 | */ |
---|
86 | |
---|
87 | #define _Context_Fp_start( _base, _offset ) \ |
---|
88 | _CPU_Context_Fp_start( (_base), (_offset) ) |
---|
89 | |
---|
90 | /* |
---|
91 | * _Context_Initialize_fp |
---|
92 | * |
---|
93 | * DESCRIPTION: |
---|
94 | * |
---|
95 | * This routine initializes the floating point context save |
---|
96 | * area to contain an initial known state. |
---|
97 | */ |
---|
98 | |
---|
99 | #define _Context_Initialize_fp( _fp_area ) \ |
---|
100 | _CPU_Context_Initialize_fp( _fp_area ) |
---|
101 | |
---|
102 | /* |
---|
103 | * _Context_Restore_fp |
---|
104 | * |
---|
105 | * DESCRIPTION: |
---|
106 | * |
---|
107 | * This routine restores the floating point context contained |
---|
108 | * in the FP_CONTEXT area. It is assumed that the current |
---|
109 | * floating point context has been saved by a previous invocation |
---|
110 | * of SAVE_FP. |
---|
111 | */ |
---|
112 | |
---|
113 | #define _Context_Restore_fp( _fp ) \ |
---|
114 | _CPU_Context_restore_fp( _fp ) |
---|
115 | |
---|
116 | /* |
---|
117 | * _Context_Save_fp |
---|
118 | * |
---|
119 | * DESCRIPTION: |
---|
120 | * |
---|
121 | * This routine saves the current floating point context |
---|
122 | * in the FP_CONTEXT area. |
---|
123 | */ |
---|
124 | |
---|
125 | #define _Context_Save_fp( _fp ) \ |
---|
126 | _CPU_Context_save_fp( _fp ) |
---|
127 | |
---|
128 | #ifdef __cplusplus |
---|
129 | } |
---|
130 | #endif |
---|
131 | |
---|
132 | #endif |
---|
133 | /* end of include file */ |
---|