summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi/src/exshutdown.c
blob: 80848f0953703919a98e070bab959aff4db7fc54 (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
/*
 *  Initialization Manager
 *
 *  COPYRIGHT (c) 1989-2011.
 *  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/init.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/interr.h>

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() ) ) {
    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( source, is_internal, code );

  /***************************************************************
   ***************************************************************
   *   SYSTEM SHUTS DOWN!!!  WE DO NOT RETURN TO THIS POINT!!!   *
   ***************************************************************
   ***************************************************************/
}