summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/interr.c
blob: 3836f527cb444b859b74008457fa5917784086fc (plain) (blame)
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
 *
 * @brief Initiates system termination
 * @ingroup ScoreIntErr
 */

/*
 *  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.com/license/LICENSE.
 */

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

#include <rtems/score/interr.h>
#include <rtems/score/isrlevel.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 _Internal_error_Occurred(
  Internal_errors_Source  the_source,
  bool                    is_internal,
  Internal_errors_t       the_error
)
{
  ISR_Level level;

  _ISR_Disable_without_giant( level );
  (void) level;

  _SMP_Request_other_cores_to_shutdown();

  _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;

  _System_state_Set( SYSTEM_STATE_TERMINATED );

  _CPU_Fatal_halt( the_error );

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