summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/interr.c
blob: 3f5ec2c473854db9b2f04361029babd50cedd62b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
 * @file
 *
 * @ingroup RTEMSScoreIntErr
 *
 * @brief This source file contains the definition of ::_System_state_Current
 *   and ::_Internal_errors_What_happened and implementation of _Terminate() and
 *   _Internal_error().
 */

/*
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <rtems/score/interr.h>
#include <rtems/score/smpimpl.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/userextimpl.h>

System_state_Codes _System_state_Current;

Internal_errors_Information _Internal_errors_What_happened;

void _Terminate(
  Internal_errors_Source the_source,
  Internal_errors_t      the_error
)
{
  _User_extensions_Fatal( the_source, the_error );

  _Internal_errors_What_happened.the_source = the_source;
  _Internal_errors_What_happened.the_error  = the_error;

  _System_state_Set( SYSTEM_STATE_TERMINATED );

  _SMP_Request_shutdown();

  _CPU_Fatal_halt( the_source, the_error );

  /* will not return from this routine */
  while (true);
}

void _Internal_error( Internal_errors_Core_list core_error )
{
  _Terminate( INTERNAL_ERROR_CORE, core_error );
}