From 1906a36a8635fe8f666bc60eab354274ffc8dcfa Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sun, 18 Nov 2012 19:51:10 +0100 Subject: score: Change _Internal_error_Occurred() Call the fatal handlers of the user extensions before the update of _Internal_errors_What_happened. This reduces the requirements on the execution context further. Now a valid read-write data is only required after the call to the fatal handlers. --- cpukit/score/include/rtems/score/interr.h | 31 +++++++++++++++++++++++-------- cpukit/score/src/interr.c | 3 +-- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'cpukit') diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index 049264995a..367c1abbba 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -166,17 +166,32 @@ typedef struct { extern Internal_errors_Information _Internal_errors_What_happened; /** - * @brief An internal or fatal error occurred. + * @brief Initiates system termination. * * This routine is invoked when the application or the executive itself - * determines that a fatal error has occurred. + * determines that a fatal error has occurred or a final system state is + * reached (for example after exit()). * - * This function can be called in every system state provided the following - * conditions are true - * - the stack pointer is valid, - * - the code memory is valid, - * - the read-only data is valid, and - * - the read-write data is accessible. + * The first action of this function is to call the fatal handler of the user + * extensions. For the initial extensions the following conditions are + * required + * - a valid stack pointer and enough stack space, + * - a valid code memory, and + * - valid read-only data. + * For the initial extensions the read-write data (including BSS segment) is + * not required. + * + * Non-initial extensions require in addition valid read-write data. The BSP + * may install an initial extension that performs a system reset. In this case + * the non-initial extensions will be not called. + * + * Once all fatal handler executed the error information will be stored to + * _Internal_errors_What_happened and the system state is set to + * SYSTEM_STATE_FAILED. + * + * The final step is to call the CPU specific _CPU_Fatal_halt(). + * + * @see rtems_fatal_error_occurred() and rtems_fatal(). */ void _Internal_error_Occurred( Internal_errors_Source the_source, diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c index a9f1efc8b9..50b3ffdde6 100644 --- a/cpukit/score/src/interr.c +++ b/cpukit/score/src/interr.c @@ -50,13 +50,12 @@ void _Internal_error_Occurred( Internal_errors_t the_error ) { + _User_extensions_Fatal( the_source, is_internal, the_error ); _Internal_errors_What_happened.the_source = the_source; _Internal_errors_What_happened.is_internal = is_internal; _Internal_errors_What_happened.the_error = the_error; - _User_extensions_Fatal( the_source, is_internal, the_error ); - _System_state_Set( SYSTEM_STATE_FAILED ); _CPU_Fatal_halt( the_error ); -- cgit v1.2.3