Let CPU/BSP Fatal handler have access to source

Without the source the error code does not say that much.
Let it be up to the CPU/BSP to determine the error code
reported on fatal shutdown.

This patch does not change the current behaviour, just
adds the option to handle the source of the fatal halt.
This commit is contained in:
Daniel Hellstrom
2014-06-04 11:23:34 +02:00
committed by Sebastian Huber
parent 12ab8d67e4
commit f82752a474
21 changed files with 26 additions and 25 deletions

View File

@@ -455,7 +455,7 @@ void _CPU_Context_Initialize(
*(*(_destination)) = _CPU_Null_fp_context; \
} while (0)
#define _CPU_Fatal_halt( _err ) \
#define _CPU_Fatal_halt( _source, _err ) \
do { \
uint32_t _level; \
uint32_t _error = _err; \

View File

@@ -814,7 +814,7 @@ uint32_t _CPU_ISR_Get_level( void );
* XXX document implementation including references if appropriate
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
}

View File

@@ -912,7 +912,7 @@ void _CPU_Context_Initialize(
*
* XXX document implementation including references if appropriate
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
__asm__ volatile ( "cli R1; \
R1 = %0; \

View File

@@ -847,8 +847,8 @@ uint32_t _CPU_ISR_Get_level( void );
* XXX
*/
#define _CPU_Fatal_halt( _error ) \
printk("Fatal Error %d Halted\n",_error); \
#define _CPU_Fatal_halt( _source, _error ) \
printk("Fatal Error %d.%d Halted\n",_source, _error); \
for(;;)

View File

@@ -525,7 +525,7 @@ uint32_t _CPU_ISR_Get_level( void );
* + disable interrupts and halt the CPU
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
uint32_t _error_lvalue = ( _error ); \
__asm__ volatile ( "cli ; \

View File

@@ -915,7 +915,7 @@ extern char _gp[];
*
* XXX document implementation including references if appropriate
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
}

View File

@@ -906,7 +906,7 @@ void _CPU_Context_Restart_self(
*
* XXX document implementation including references if appropriate
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
}

View File

@@ -924,7 +924,7 @@ void _CPU_Context_Restart_self(
*
* XXX document implementation including references if appropriate
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
}

View File

@@ -479,7 +479,7 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored );
*/
#if ( defined(__mcoldfire__) )
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ __asm__ volatile( "move.w %%sr,%%d0\n\t" \
"or.l %2,%%d0\n\t" \
"move.w %%d0,%%sr\n\t" \
@@ -491,7 +491,7 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored );
: "d0", "d1" ); \
}
#else
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ __asm__ volatile( "movl %0,%%d0; " \
"orw #0x0700,%%sr; " \
"stop #0x2700" : "=d" ((_error)) : "0" ((_error)) ); \

View File

@@ -913,7 +913,7 @@ void _CPU_Context_Initialize(
* halts/stops the CPU.
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
do { \
unsigned int _level; \
_CPU_ISR_Disable(_level); \

View File

@@ -733,8 +733,8 @@ uint32_t _CPU_ISR_Get_level( void );
*
* XXX
*/
#define _CPU_Fatal_halt( _error ) \
printk("Fatal Error %d Halted\n",_error); \
#define _CPU_Fatal_halt( _source, _error ) \
printk("Fatal Error %d.%d Halted\n",_source,_error); \
for(;;)
/* end of Fatal Error manager macros */

View File

@@ -14,7 +14,7 @@
#include <rtems/score/cpu.h>
#include <rtems/score/nios2-utility.h>
void _CPU_Fatal_halt( uint32_t _error )
void _CPU_Fatal_halt( uint32_t _source, uint32_t _error )
{
/* write 0 to status register (disable interrupts) */
__builtin_wrctl( NIOS2_CTLREG_INDEX_STATUS, 0 );

View File

@@ -133,5 +133,5 @@ void __ISR_Handler(void)
void __Exception_Handler(CPU_Exception_frame *efr)
{
_CPU_Fatal_halt(0xECC0);
_CPU_Fatal_halt(RTEMS_FATAL_SOURCE_EXCEPTION, 0xECC0); /* source ignored */
}

View File

@@ -310,7 +310,8 @@ void _CPU_Context_Initialize(
#define _CPU_Context_Restart_self( _the_context ) \
_CPU_Context_restore( (_the_context) );
void _CPU_Fatal_halt( uint32_t _error ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
void _CPU_Fatal_halt( uint32_t _source, uint32_t _error )
RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
/**
* @brief CPU initialization.

View File

@@ -1071,7 +1071,7 @@ uint32_t _CPU_ISR_Get_level( void );
*
* XXX document implementation including references if appropriate
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
{ \
}

View File

@@ -677,7 +677,7 @@ void _BSP_Fatal_error(unsigned int);
#endif /* ASM */
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
_BSP_Fatal_error(_error)
/* end of Fatal Error manager macros */

View File

@@ -675,9 +675,9 @@ SCORE_EXTERN void _CPU_Context_Initialize(
#ifdef BSP_FATAL_HALT
/* we manage the fatal error in the board support package */
void bsp_fatal_halt( uint32_t _error);
#define _CPU_Fatal_halt( _error ) bsp_fatal_halt( _error)
#define _CPU_Fatal_halt( _source, _error ) bsp_fatal_halt( _error)
#else
#define _CPU_Fatal_halt( _error)\
#define _CPU_Fatal_halt( _source, _error)\
{ \
__asm__ volatile("mov.l %0,r0"::"m" (_error)); \
__asm__ volatile("mov #1, r4"); \

View File

@@ -1080,7 +1080,7 @@ void _CPU_Context_Initialize(
* location or a register, optionally disables interrupts, and
* halts/stops the CPU.
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
do { \
uint32_t level; \
\

View File

@@ -905,7 +905,7 @@ void _CPU_Context_Initialize(
* halts/stops the CPU.
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
do { \
uint32_t level; \
\

View File

@@ -871,7 +871,7 @@ void _CPU_Context_Initialize(
*
* Move the error code into r10, disable interrupts and halt.
*/
#define _CPU_Fatal_halt( _error ) \
#define _CPU_Fatal_halt( _source, _error ) \
do { \
__asm__ __volatile__ ( "di" ); \
__asm__ __volatile__ ( "mov %0, r10; " : "=r" ((_error)) ); \

View File

@@ -49,7 +49,7 @@ void _Terminate(
_System_state_Set( SYSTEM_STATE_TERMINATED );
_CPU_Fatal_halt( the_error );
_CPU_Fatal_halt( the_source, the_error );
/* will not return from this routine */
while (true);