source: rtems/cpukit/score/include/rtems/score/interr.h @ f7f1d77

4.115
Last change on this file since f7f1d77 was 815994f, checked in by Sebastian Huber <sebastian.huber@…>, on 11/25/12 at 16:48:11

score: Add CPU_Exception_frame

Add CPU port type CPU_Exception_frame and function
_CPU_Exception_frame_print().

The CPU ports of avr, bfin, h8300, lm32, m32c, m32r, m68k, nios2, sh,
sparc64, and v850 use an empty default implementation of
_CPU_Exception_frame_print().

Add rtems_exception_frame and rtems_exception_frame_print().

Add RTEMS_FATAL_SOURCE_EXCEPTION for CPU exceptions. Use rtems_fatal()
with source RTEMS_FATAL_SOURCE_EXCEPTION in CPU ports of i386, powerpc,
and sparc for unexpected exceptions.

Add third parameter to RTEMS_BSP_CLEANUP_OPTIONS() which controls the
BSP_PRINT_EXCEPTION_CONTEXT define used in the default
bsp_fatal_extension().

Add test sptests/spfatal26.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/**
2 *  @file  rtems/score/interr.h
3 *
4 *  This include file contains constants and prototypes related
5 *  to the Internal Error Handler.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#ifndef _RTEMS_SCORE_INTERR_H
18#define _RTEMS_SCORE_INTERR_H
19
20#include <stdbool.h>
21#include <stdint.h>
22
23#include <rtems/system.h>
24
25/**
26 *  @defgroup ScoreIntErr Internal Error Handler
27 *
28 *  @ingroup Score
29 *
30 *  This handler encapsulates functionality which provides the foundation
31 *  Semaphore services used in all of the APIs supported by RTEMS.
32 */
33/**@{*/
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 *  @brief This type lists the possible sources from which an error
41 *  can be reported.
42 */
43typedef enum {
44  INTERNAL_ERROR_CORE,
45  INTERNAL_ERROR_RTEMS_API,
46  INTERNAL_ERROR_POSIX_API,
47
48  /**
49   * @brief Fatal source for the block device cache.
50   *
51   * @see rtems_bdbuf_fatal_code.
52   */
53  RTEMS_FATAL_SOURCE_BDBUF,
54
55  /**
56   * @brief Fatal source for application specific errors.
57   *
58   * The fatal code is application specific.
59   */
60  RTEMS_FATAL_SOURCE_APPLICATION,
61
62  /**
63   * @brief Fatal source of exit().
64   *
65   * The fatal code is the exit() status code.
66   */
67  RTEMS_FATAL_SOURCE_EXIT,
68
69  /**
70   * @brief Fatal source for generic BSP errors.
71   *
72   * The fatal codes are defined in <bsp/bootcard.h>.  Examples are interrupt
73   * and exception initialization.
74   *
75   * @see bsp_generic_fatal_code.
76   */
77  RTEMS_FATAL_SOURCE_BSP_GENERIC,
78
79  /**
80   * @brief Fatal source for BSP specific errors.
81   *
82   * The fatal code is BSP specific.
83   */
84  RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
85
86  /**
87   * @brief Fatal source of assert().
88   *
89   * The fatal code is the pointer value of the function string.
90   */
91  RTEMS_FATAL_SOURCE_ASSERT,
92
93  /**
94   * @brief Fatal source of the stack checker.
95   *
96   * The fatal code is the object name of the executing task.
97   */
98  RTEMS_FATAL_SOURCE_STACK_CHECKER,
99
100  /**
101   * @brief Fatal source of the exceptions.
102   *
103   * The fatal code is the pointer value of the exception frame pointer.
104   *
105   * @see rtems_exception_frame and rtems_exception_frame_print().
106   */
107  RTEMS_FATAL_SOURCE_EXCEPTION,
108
109  /**
110   * @brief The last available fatal source.
111   *
112   * This enum value ensures that the enum type needs at least 32-bits for
113   * architectures with short enums.
114   */
115  RTEMS_FATAL_SOURCE_LAST = 0xffffffff
116} Internal_errors_Source;
117
118/**
119 *  A list of errors which are generated internally by the executive core.
120 */
121typedef enum {
122  INTERNAL_ERROR_NO_CONFIGURATION_TABLE,
123  INTERNAL_ERROR_NO_CPU_TABLE,
124  INTERNAL_ERROR_TOO_LITTLE_WORKSPACE,
125  INTERNAL_ERROR_WORKSPACE_ALLOCATION,
126  INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL,
127  INTERNAL_ERROR_THREAD_EXITTED,
128  INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION,
129  INTERNAL_ERROR_INVALID_NODE,
130  INTERNAL_ERROR_NO_MPCI,
131  INTERNAL_ERROR_BAD_PACKET,
132  INTERNAL_ERROR_OUT_OF_PACKETS,
133  INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS,
134  INTERNAL_ERROR_OUT_OF_PROXIES,
135  INTERNAL_ERROR_INVALID_GLOBAL_ID,
136  INTERNAL_ERROR_BAD_STACK_HOOK,
137  INTERNAL_ERROR_BAD_ATTRIBUTES,
138  INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY,
139  INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL,
140  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE,
141  INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0,
142  INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP,
143  INTERNAL_ERROR_GXX_KEY_ADD_FAILED,
144  INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED,
145  INTERNAL_ERROR_NO_MEMORY_FOR_HEAP,
146  INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR
147} Internal_errors_Core_list;
148
149typedef uint32_t Internal_errors_t;
150
151/**
152 *  This type holds the fatal error information.
153 */
154typedef struct {
155  /** This is the source of the error. */
156  Internal_errors_Source  the_source;
157  /** This indicates if the error is internal of external. */
158  bool                    is_internal;
159  /** This is the error code. */
160  Internal_errors_t       the_error;
161} Internal_errors_Information;
162
163/**
164 *  When a fatal error occurs, the error information is stored here.
165 */
166extern Internal_errors_Information _Internal_errors_What_happened;
167
168/**
169 * @brief Initiates system termination.
170 *
171 * This routine is invoked when the application or the executive itself
172 * determines that a fatal error has occurred or a final system state is
173 * reached (for example after exit()).
174 *
175 * The first action of this function is to call the fatal handler of the user
176 * extensions.  For the initial extensions the following conditions are
177 * required
178 * - a valid stack pointer and enough stack space,
179 * - a valid code memory, and
180 * - valid read-only data.
181 * For the initial extensions the read-write data (including BSS segment) is
182 * not required.
183 *
184 * Non-initial extensions require in addition valid read-write data.  The BSP
185 * may install an initial extension that performs a system reset.  In this case
186 * the non-initial extensions will be not called.
187 *
188 * Once all fatal handler executed the error information will be stored to
189 * _Internal_errors_What_happened and the system state is set to
190 * SYSTEM_STATE_FAILED.
191 *
192 * The final step is to call the CPU specific _CPU_Fatal_halt().
193 *
194 * @see rtems_fatal_error_occurred() and rtems_fatal().
195 */
196void _Internal_error_Occurred(
197  Internal_errors_Source  the_source,
198  bool                    is_internal,
199  Internal_errors_t       the_error
200) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
201
202#ifdef __cplusplus
203}
204#endif
205
206/**@}*/
207
208#endif
209/* end of include file */
Note: See TracBrowser for help on using the repository browser.