mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-28 15:53:06 +08:00
score: Delete _Thread_BSP_context
Do not return to BSP context in the exit() shutdown path. This makes it possible to re-use the initialization stack. It can be used for the interrupt stack for example. On targets with a small RAM this is a considerable benefit. This change eliminates also some special cases and simplifies the code. Delete _Thread_Set_global_exit_status(), _Thread_Get_global_exit_status() and _Thread_Stop_multitasking().
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
#include <rtems/config.h>
|
||||
#include <rtems/debug.h>
|
||||
#include <rtems/extensionimpl.h>
|
||||
#include <rtems/fatal.h>
|
||||
#include <rtems/init.h>
|
||||
#include <rtems/io.h>
|
||||
#include <rtems/score/sysstate.h>
|
||||
@@ -215,25 +214,20 @@ void rtems_initialize_device_drivers(void)
|
||||
|
||||
void rtems_initialize_start_multitasking(void)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
_System_state_Set( SYSTEM_STATE_UP );
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
_SMP_Request_other_cores_to_perform_first_context_switch();
|
||||
#endif
|
||||
|
||||
_Thread_Start_multitasking( &_Thread_BSP_context );
|
||||
_Thread_Start_multitasking();
|
||||
|
||||
/*******************************************************************
|
||||
*******************************************************************
|
||||
*******************************************************************
|
||||
****** APPLICATION RUNS HERE ******
|
||||
****** RETURNS WHEN SYSTEM IS SHUT DOWN ******
|
||||
****** THE FUNCTION NEVER RETURNS ******
|
||||
*******************************************************************
|
||||
*******************************************************************
|
||||
*******************************************************************/
|
||||
|
||||
status = _Thread_Get_global_exit_status();
|
||||
rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
|
||||
}
|
||||
|
||||
@@ -15,47 +15,37 @@
|
||||
|
||||
#include <rtems/init.h>
|
||||
#include <rtems/score/sysstate.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#include <rtems/score/interr.h>
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
#include <rtems/score/smp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rtems_shutdown_executive
|
||||
*
|
||||
* This kernel routine shutdowns the executive. It halts multitasking
|
||||
* and returns control to the application execution "thread" which
|
||||
* initialially invoked the rtems_initialize_executive directive.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void rtems_shutdown_executive(
|
||||
uint32_t result
|
||||
)
|
||||
void rtems_shutdown_executive( uint32_t result )
|
||||
{
|
||||
Internal_errors_Source source;
|
||||
bool is_internal;
|
||||
Internal_errors_t code;
|
||||
|
||||
if ( _System_state_Is_up( _System_state_Get() ) ) {
|
||||
#if defined(RTEMS_SMP)
|
||||
_SMP_Request_other_cores_to_shutdown();
|
||||
#endif
|
||||
|
||||
_Thread_Set_global_exit_status( result );
|
||||
_Thread_Stop_multitasking();
|
||||
|
||||
/*******************************************************************
|
||||
*******************************************************************
|
||||
****** RETURN TO RTEMS_INITIALIZE_START_MULTITASKING() ******
|
||||
****** AND THEN TO BOOT_CARD() ******
|
||||
*******************************************************************
|
||||
*******************************************************************/
|
||||
source = RTEMS_FATAL_SOURCE_EXIT;
|
||||
is_internal = false;
|
||||
code = result;
|
||||
} else {
|
||||
source = INTERNAL_ERROR_CORE;
|
||||
is_internal = true;
|
||||
code = INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP;
|
||||
}
|
||||
_Internal_error_Occurred(
|
||||
INTERNAL_ERROR_CORE,
|
||||
true,
|
||||
INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP
|
||||
);
|
||||
|
||||
_Internal_error_Occurred( source, is_internal, code );
|
||||
|
||||
/***************************************************************
|
||||
***************************************************************
|
||||
* SYSTEM SHUTS DOWN!!! WE DO NOT RETURN TO THIS POINT!!! *
|
||||
***************************************************************
|
||||
***************************************************************/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user