RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/shared/bootcard.c,v
retrieving revision 1.15
diff -u -r1.15 bootcard.c
|
|
|
31 | 31 | * $Id: bootcard.c,v 1.15 2006/11/15 15:20:05 joel Exp $ |
32 | 32 | */ |
33 | 33 | |
| 34 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
34 | 35 | #include <bsp.h> |
35 | 36 | |
36 | 37 | #if defined(__USE_INIT_FINI__) |
… |
… |
|
65 | 66 | |
66 | 67 | int boot_card(int argc, char **argv, char **envp) |
67 | 68 | { |
68 | | int status; |
| 69 | int status = 0; |
69 | 70 | static char *argv_pointer = NULL; |
70 | 71 | static char *envp_pointer = NULL; |
71 | 72 | char **argv_p = &argv_pointer; |
… |
… |
|
115 | 116 | #endif |
116 | 117 | |
117 | 118 | /* |
118 | | * XXX |
| 119 | * Invoke the BSP specific pre-device driver initialization code. |
119 | 120 | */ |
120 | 121 | |
121 | 122 | bsp_start(); |
… |
… |
|
127 | 128 | bsp_isr_level = |
128 | 129 | rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table ); |
129 | 130 | |
130 | | /* |
131 | | * The atexit hook will be before the static destructor list's entry |
132 | | * point. |
133 | | */ |
134 | | |
135 | | #if defined(__USE_INIT_FINI__) |
136 | | atexit( _fini ); |
137 | | #endif |
138 | | |
139 | | /* |
140 | | * Call c_rtems_main() and eventually let the first task or the real |
141 | | * main() invoke the global constructors if there are any. |
142 | | */ |
143 | | |
144 | | if ((argc > 0) && argv && argv[0]) |
145 | | rtems_progname = argv[0]; |
146 | | else |
147 | | rtems_progname = "RTEMS"; |
148 | | |
149 | | rtems_initialize_executive_late( bsp_isr_level ); |
150 | | |
151 | | /* |
152 | | * Perform any BSP specific shutdown actions. |
153 | | */ |
154 | | |
155 | | bsp_cleanup(); |
| 131 | if ( _System_state_Get() == SYSTEM_STATE_BETWEEN_EARLY_AND_LATE ) { |
| 132 | /* |
| 133 | * The atexit hook will be before the static destructor list's entry |
| 134 | * point. |
| 135 | */ |
| 136 | #if defined(__USE_INIT_FINI__) |
| 137 | atexit( _fini ); |
| 138 | #endif |
| 139 | |
| 140 | /* |
| 141 | * Provide enough information to pass arguments. |
| 142 | */ |
| 143 | if ((argc > 0) && argv && argv[0]) |
| 144 | rtems_progname = argv[0]; |
| 145 | else |
| 146 | rtems_progname = "RTEMS"; |
| 147 | |
| 148 | rtems_initialize_executive_late( bsp_isr_level ); |
| 149 | |
| 150 | /* |
| 151 | * Perform any BSP specific shutdown actions. |
| 152 | */ |
| 153 | bsp_cleanup(); |
| 154 | } |
156 | 155 | |
157 | 156 | /* |
158 | 157 | * Now return to the start code. |
159 | 158 | */ |
160 | | |
161 | 159 | return status; |
162 | 160 | } |
RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/newlibc.c,v
retrieving revision 1.52
diff -u -r1.52 newlibc.c
|
|
|
368 | 368 | * associated with this task. |
369 | 369 | */ |
370 | 370 | |
371 | | libc_wrapup(); |
| 371 | if (_System_state_Is_up(_System_state_Get())) |
| 372 | libc_wrapup(); |
372 | 373 | rtems_shutdown_executive(status); |
373 | 374 | for (;;) ; /* to avoid warnings */ |
374 | 375 | } |
… |
… |
|
377 | 378 | |
378 | 379 | void exit(int status) |
379 | 380 | { |
380 | | libc_wrapup(); |
| 381 | if (_System_state_Is_up(_System_state_Get())) |
| 382 | libc_wrapup(); |
381 | 383 | rtems_shutdown_executive(status); |
382 | 384 | for (;;) ; /* to avoid warnings */ |
383 | 385 | } |
RCS file: /usr1/CVS/rtems/cpukit/sapi/src/exinit.c,v
retrieving revision 1.34
diff -u -r1.34 exinit.c
|
|
|
125 | 125 | |
126 | 126 | _CPU_Initialize( cpu_table, _Thread_Dispatch ); |
127 | 127 | |
| 128 | |
| 129 | /* |
| 130 | * At this point, we should be able to context switch to ourselves |
| 131 | * so we can shutdown back to here. |
| 132 | */ |
| 133 | _Context_Switch( &_Thread_BSP_context, &_Thread_BSP_context ); |
| 134 | if ( _System_state_Get () != SYSTEM_STATE_BEFORE_INITIALIZATION ) { |
| 135 | _System_state_Set( SYSTEM_STATE_SHUTDOWN ); |
| 136 | return bsp_level; |
| 137 | } |
| 138 | |
| 139 | _System_state_Set( SYSTEM_STATE_BEFORE_SCORE_INITIALIZATION ); |
| 140 | |
128 | 141 | /* |
129 | 142 | * Do this as early as possible to insure no debugging output |
130 | 143 | * is even attempted to be printed. |
… |
… |
|
257 | 270 | if ( _CPU_Table.postdriver_hook ) |
258 | 271 | (*_CPU_Table.postdriver_hook)(); |
259 | 272 | |
| 273 | _System_state_Set( SYSTEM_STATE_BETWEEN_EARLY_AND_LATE ); |
260 | 274 | return bsp_level; |
261 | 275 | } |
262 | 276 | |
… |
… |
|
296 | 310 | uint32_t result |
297 | 311 | ) |
298 | 312 | { |
299 | | if ( _System_state_Current != SYSTEM_STATE_SHUTDOWN ) { |
300 | | _System_state_Set( SYSTEM_STATE_SHUTDOWN ); |
301 | | _Thread_Stop_multitasking(); |
| 313 | switch ( _System_state_Get() ) { |
| 314 | case SYSTEM_STATE_BEFORE_INITIALIZATION: |
| 315 | case SYSTEM_STATE_BEFORE_SCORE_INITIALIZATION: |
| 316 | case SYSTEM_STATE_BEFORE_MULTITASKING: |
| 317 | case SYSTEM_STATE_BEGIN_MULTITASKING: |
| 318 | case SYSTEM_STATE_BETWEEN_EARLY_AND_LATE: |
| 319 | { |
| 320 | Context_Control junk; |
| 321 | _System_state_Set( SYSTEM_STATE_FAILED ); |
| 322 | _Context_Switch( &junk, &_Thread_BSP_context ); |
| 323 | break; |
| 324 | } |
| 325 | case SYSTEM_STATE_UP: |
| 326 | _System_state_Set( SYSTEM_STATE_SHUTDOWN ); |
| 327 | _Thread_Stop_multitasking(); |
| 328 | break; |
| 329 | case SYSTEM_STATE_SHUTDOWN: |
| 330 | case SYSTEM_STATE_FAILED: |
| 331 | break; |
302 | 332 | } |
303 | 333 | } |
RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/sysstate.h,v
retrieving revision 1.21
diff -u -r1.21 sysstate.h
|
|
|
46 | 46 | /** This indicates that the system state is between end of the first |
47 | 47 | * phase of initializatin but before multitasking is started. |
48 | 48 | */ |
| 49 | SYSTEM_STATE_BEFORE_SCORE_INITIALIZATION, |
| 50 | /** This indicates that the system state is between end of SuperCore |
| 51 | * initialization but before multitasking is started. |
| 52 | */ |
49 | 53 | SYSTEM_STATE_BEFORE_MULTITASKING, |
50 | 54 | /** This indicates that the system state is attempting to initiate |
51 | 55 | * multitasking. |
52 | 56 | */ |
53 | 57 | SYSTEM_STATE_BEGIN_MULTITASKING, |
| 58 | /** This indicates that the system is normal and between |
| 59 | * rtems_initialize_executive_early and rtems_initialize_executive_late. |
| 60 | */ |
| 61 | SYSTEM_STATE_BETWEEN_EARLY_AND_LATE, |
54 | 62 | /** This indicates that the system is up and operating normally. */ |
55 | 63 | SYSTEM_STATE_UP, |
56 | 64 | /** This indicates that the system is in the midst of a shutdown. */ |