[20f02c6] | 1 | /** |
---|
[5ad74fd6] | 2 | * @file |
---|
[3a4ae6c] | 3 | * |
---|
[5ad74fd6] | 4 | * @ingroup RTEMSScoreIntErr |
---|
[319cb20] | 5 | * |
---|
[9278f3d] | 6 | * @brief This header file provides the interfaces of the |
---|
| 7 | * @ref RTEMSScoreIntErr. |
---|
[baff4da] | 8 | */ |
---|
| 9 | |
---|
| 10 | /* |
---|
[4b72da4] | 11 | * COPYRIGHT (c) 1989-2009. |
---|
[3a4ae6c] | 12 | * On-Line Applications Research Corporation (OAR). |
---|
| 13 | * |
---|
[98e4ebf5] | 14 | * The license and distribution terms for this file may be |
---|
| 15 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 16 | * http://www.rtems.org/license/LICENSE. |
---|
[3a4ae6c] | 17 | */ |
---|
| 18 | |
---|
[092f142a] | 19 | #ifndef _RTEMS_SCORE_INTERR_H |
---|
| 20 | #define _RTEMS_SCORE_INTERR_H |
---|
[3a4ae6c] | 21 | |
---|
[3fe2155] | 22 | #include <rtems/score/cpu.h> |
---|
[25e02d5] | 23 | |
---|
[baff4da] | 24 | /** |
---|
[5ad74fd6] | 25 | * @defgroup RTEMSScoreIntErr Internal Error Handler |
---|
| 26 | * |
---|
| 27 | * @ingroup RTEMSScore |
---|
| 28 | * |
---|
[c81ac0e] | 29 | * @brief This group contains the Internal Error Handler implementation. |
---|
[baff4da] | 30 | * |
---|
[c81ac0e] | 31 | * This handler encapsulates functionality to terminate the system. |
---|
[d8cd045c] | 32 | * |
---|
[5ad74fd6] | 33 | * @{ |
---|
[baff4da] | 34 | */ |
---|
| 35 | |
---|
[3a4ae6c] | 36 | #ifdef __cplusplus |
---|
| 37 | extern "C" { |
---|
| 38 | #endif |
---|
| 39 | |
---|
[baff4da] | 40 | /** |
---|
[156e91e] | 41 | * @brief This type lists the possible sources from which an error |
---|
[3a4ae6c] | 42 | * can be reported. |
---|
| 43 | */ |
---|
| 44 | typedef enum { |
---|
[51acbdc] | 45 | /** |
---|
| 46 | * @brief Errors of the core system. |
---|
| 47 | * |
---|
| 48 | * @see Internal_errors_Core_list. |
---|
| 49 | */ |
---|
[f6edd880] | 50 | INTERNAL_ERROR_CORE = 0, |
---|
[51acbdc] | 51 | |
---|
| 52 | /** |
---|
| 53 | * @brief Errors of the RTEMS API. |
---|
| 54 | */ |
---|
[f6edd880] | 55 | INTERNAL_ERROR_RTEMS_API = 1, |
---|
[51acbdc] | 56 | |
---|
| 57 | /** |
---|
| 58 | * @brief Errors of the POSIX API. |
---|
| 59 | */ |
---|
[f6edd880] | 60 | INTERNAL_ERROR_POSIX_API = 2, |
---|
[156e91e] | 61 | |
---|
[608940f] | 62 | /** |
---|
| 63 | * @brief Fatal source for the block device cache. |
---|
| 64 | * |
---|
| 65 | * @see rtems_bdbuf_fatal_code. |
---|
| 66 | */ |
---|
[f6edd880] | 67 | RTEMS_FATAL_SOURCE_BDBUF = 3, |
---|
[608940f] | 68 | |
---|
[038e2f4a] | 69 | /** |
---|
| 70 | * @brief Fatal source for application specific errors. |
---|
| 71 | * |
---|
| 72 | * The fatal code is application specific. |
---|
| 73 | */ |
---|
[f6edd880] | 74 | RTEMS_FATAL_SOURCE_APPLICATION = 4, |
---|
[038e2f4a] | 75 | |
---|
[a052181] | 76 | /** |
---|
| 77 | * @brief Fatal source of exit(). |
---|
| 78 | * |
---|
| 79 | * The fatal code is the exit() status code. |
---|
| 80 | */ |
---|
[f6edd880] | 81 | RTEMS_FATAL_SOURCE_EXIT = 5, |
---|
[a052181] | 82 | |
---|
[9d10cf90] | 83 | /** |
---|
[33cb8bf] | 84 | * @brief Fatal source for BSP errors. |
---|
[9d10cf90] | 85 | * |
---|
[33cb8bf] | 86 | * The fatal codes are defined in <bsp/fatal.h>. Examples are interrupt and |
---|
| 87 | * exception initialization. |
---|
[9d10cf90] | 88 | * |
---|
[33cb8bf] | 89 | * @see bsp_fatal_code and bsp_fatal(). |
---|
[9d10cf90] | 90 | */ |
---|
[f6edd880] | 91 | RTEMS_FATAL_SOURCE_BSP = 6, |
---|
[b9bc399] | 92 | |
---|
[a0c7aa55] | 93 | /** |
---|
| 94 | * @brief Fatal source of assert(). |
---|
| 95 | * |
---|
[68f36d14] | 96 | * The fatal code is the pointer value of the assert context. |
---|
| 97 | * |
---|
| 98 | * @see rtems_assert_context. |
---|
[a0c7aa55] | 99 | */ |
---|
[f6edd880] | 100 | RTEMS_FATAL_SOURCE_ASSERT = 7, |
---|
[a0c7aa55] | 101 | |
---|
[a12f7e9] | 102 | /** |
---|
| 103 | * @brief Fatal source of the stack checker. |
---|
| 104 | * |
---|
| 105 | * The fatal code is the object name of the executing task. |
---|
| 106 | */ |
---|
[f6edd880] | 107 | RTEMS_FATAL_SOURCE_STACK_CHECKER = 8, |
---|
[a12f7e9] | 108 | |
---|
[7e32b62] | 109 | /** |
---|
[815994f] | 110 | * @brief Fatal source of the exceptions. |
---|
[7e32b62] | 111 | * |
---|
| 112 | * The fatal code is the pointer value of the exception frame pointer. |
---|
| 113 | * |
---|
[815994f] | 114 | * @see rtems_exception_frame and rtems_exception_frame_print(). |
---|
[7e32b62] | 115 | */ |
---|
[f6edd880] | 116 | RTEMS_FATAL_SOURCE_EXCEPTION = 9, |
---|
[7e32b62] | 117 | |
---|
[9eec2f3] | 118 | /** |
---|
| 119 | * @brief Fatal source of SMP domain. |
---|
| 120 | * |
---|
| 121 | * @see SMP_Fatal_code. |
---|
| 122 | */ |
---|
[f6edd880] | 123 | RTEMS_FATAL_SOURCE_SMP = 10, |
---|
[9eec2f3] | 124 | |
---|
[15e19273] | 125 | /** |
---|
| 126 | * @brief Fatal source of rtems_panic(). |
---|
| 127 | * |
---|
| 128 | * @see rtem |
---|
| 129 | */ |
---|
| 130 | RTEMS_FATAL_SOURCE_PANIC = 11, |
---|
| 131 | |
---|
[de9b7d7] | 132 | /** |
---|
| 133 | * @brief Fatal source for invalid C program heap frees via free(). |
---|
| 134 | * |
---|
| 135 | * The fatal code is the bad pointer. |
---|
| 136 | */ |
---|
| 137 | RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE = 12, |
---|
| 138 | |
---|
[3859cd63] | 139 | /** |
---|
| 140 | * @brief Fatal source for heap errors. |
---|
| 141 | * |
---|
| 142 | * The fatal code is the address to a heap error context (Heap_Error_context). |
---|
| 143 | */ |
---|
| 144 | RTEMS_FATAL_SOURCE_HEAP = 13, |
---|
| 145 | |
---|
[4969af4] | 146 | /** |
---|
| 147 | * @brief Fatal source for spurious interrupts. |
---|
| 148 | * |
---|
| 149 | * The fatal code is the interrupt vector number of the spurious interrupt. |
---|
| 150 | */ |
---|
| 151 | RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT = 14, |
---|
| 152 | |
---|
[156e91e] | 153 | /** |
---|
| 154 | * @brief The last available fatal source. |
---|
| 155 | * |
---|
| 156 | * This enum value ensures that the enum type needs at least 32-bits for |
---|
| 157 | * architectures with short enums. |
---|
| 158 | */ |
---|
| 159 | RTEMS_FATAL_SOURCE_LAST = 0xffffffff |
---|
[3a4ae6c] | 160 | } Internal_errors_Source; |
---|
| 161 | |
---|
[6a07436] | 162 | /** |
---|
[bee0323] | 163 | * @brief A list of errors which are generated internally by the executive |
---|
| 164 | * core. |
---|
| 165 | * |
---|
[c4d89de] | 166 | * Do not re-use numbers of obsolete error codes. Comment no longer used |
---|
| 167 | * error codes and do not uncomment commented or obsolete error codes. |
---|
[3a4ae6c] | 168 | */ |
---|
| 169 | typedef enum { |
---|
[bee0323] | 170 | /* INTERNAL_ERROR_NO_CONFIGURATION_TABLE = 0, */ |
---|
| 171 | /* INTERNAL_ERROR_NO_CPU_TABLE = 1, */ |
---|
| 172 | INTERNAL_ERROR_TOO_LITTLE_WORKSPACE = 2, |
---|
[78211376] | 173 | /* INTERNAL_ERROR_WORKSPACE_ALLOCATION = 3, */ |
---|
[56e61e24] | 174 | /* INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL = 4, */ |
---|
[bee0323] | 175 | INTERNAL_ERROR_THREAD_EXITTED = 5, |
---|
| 176 | INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION = 6, |
---|
| 177 | INTERNAL_ERROR_INVALID_NODE = 7, |
---|
| 178 | INTERNAL_ERROR_NO_MPCI = 8, |
---|
| 179 | INTERNAL_ERROR_BAD_PACKET = 9, |
---|
| 180 | INTERNAL_ERROR_OUT_OF_PACKETS = 10, |
---|
| 181 | INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS = 11, |
---|
| 182 | INTERNAL_ERROR_OUT_OF_PROXIES = 12, |
---|
| 183 | INTERNAL_ERROR_INVALID_GLOBAL_ID = 13, |
---|
[c5af8aa0] | 184 | /* INTERNAL_ERROR_BAD_STACK_HOOK = 14, */ |
---|
[bee0323] | 185 | /* INTERNAL_ERROR_BAD_ATTRIBUTES = 15, */ |
---|
| 186 | /* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */ |
---|
| 187 | /* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */ |
---|
| 188 | /* INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_FROM_BAD_STATE = 18, */ |
---|
[21275b58] | 189 | /* INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19, */ |
---|
[bee0323] | 190 | /* INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP = 20, */ |
---|
| 191 | INTERNAL_ERROR_GXX_KEY_ADD_FAILED = 21, |
---|
| 192 | INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED = 22, |
---|
| 193 | INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23, |
---|
| 194 | INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24, |
---|
| 195 | INTERNAL_ERROR_RESOURCE_IN_USE = 25, |
---|
[bc175a1] | 196 | /* INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26, */ |
---|
[cd3e220] | 197 | /* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */ |
---|
[bee0323] | 198 | INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28, |
---|
| 199 | INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29, |
---|
| 200 | INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL = 30, |
---|
[279d5260] | 201 | INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT = 31, |
---|
[0a81a58] | 202 | INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED = 32, |
---|
[82529688] | 203 | INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED = 33, |
---|
[ba74ebde] | 204 | /* INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34, */ |
---|
[bc5b56a] | 205 | /* INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35, */ |
---|
[e203b65e] | 206 | INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36, |
---|
[600d88d] | 207 | INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37, |
---|
[ddc339c] | 208 | INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38, |
---|
[7c19e50] | 209 | INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL = 39, |
---|
[c312f31] | 210 | INTERNAL_ERROR_NO_MEMORY_FOR_PER_CPU_DATA = 40, |
---|
[657e30c1] | 211 | INTERNAL_ERROR_TOO_LARGE_TLS_SIZE = 41, |
---|
| 212 | INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED = 42, |
---|
[3a4ae6c] | 213 | } Internal_errors_Core_list; |
---|
| 214 | |
---|
[46d3c6d8] | 215 | typedef CPU_Uint32ptr Internal_errors_t; |
---|
[25e02d5] | 216 | |
---|
[4b72da4] | 217 | /** |
---|
[1906a36] | 218 | * @brief Initiates system termination. |
---|
[3a4ae6c] | 219 | * |
---|
[891d0d96] | 220 | * This routine is invoked when the application or the executive itself |
---|
[1906a36] | 221 | * determines that a fatal error has occurred or a final system state is |
---|
| 222 | * reached (for example after exit()). |
---|
[891d0d96] | 223 | * |
---|
[008efaf] | 224 | * The first action of this function is to call the fatal handler of the user |
---|
[1906a36] | 225 | * extensions. For the initial extensions the following conditions are |
---|
| 226 | * required |
---|
| 227 | * - a valid stack pointer and enough stack space, |
---|
| 228 | * - a valid code memory, and |
---|
| 229 | * - valid read-only data. |
---|
[f8ac52f2] | 230 | * |
---|
[1906a36] | 231 | * For the initial extensions the read-write data (including BSS segment) is |
---|
[8a6de83] | 232 | * not required on single processor configurations. On SMP configurations |
---|
| 233 | * however the read-write data must be initialized since this function must |
---|
| 234 | * determine the state of the other processors and request them to shut-down if |
---|
| 235 | * necessary. |
---|
[1906a36] | 236 | * |
---|
| 237 | * Non-initial extensions require in addition valid read-write data. The BSP |
---|
| 238 | * may install an initial extension that performs a system reset. In this case |
---|
| 239 | * the non-initial extensions will be not called. |
---|
| 240 | * |
---|
[bf338f04] | 241 | * Once all fatal handler executed the system state is set to |
---|
[92f50c3] | 242 | * SYSTEM_STATE_TERMINATED. |
---|
[1906a36] | 243 | * |
---|
| 244 | * The final step is to call the CPU specific _CPU_Fatal_halt(). |
---|
| 245 | * |
---|
[5ad74fd6] | 246 | * @param the_source The fatal source indicating the subsystem the fatal |
---|
[f8ac52f2] | 247 | * condition originated in. |
---|
[5ad74fd6] | 248 | * @param the_error The fatal error code. This value must be interpreted |
---|
[f8ac52f2] | 249 | * with respect to the source. |
---|
[bf54252] | 250 | * |
---|
[b6606e8] | 251 | * @see rtems_fatal() and _Internal_error(). |
---|
[3a4ae6c] | 252 | */ |
---|
[d7a48e1] | 253 | RTEMS_NO_RETURN void _Terminate( |
---|
[3a4ae6c] | 254 | Internal_errors_Source the_source, |
---|
[25e02d5] | 255 | Internal_errors_t the_error |
---|
[d7a48e1] | 256 | ); |
---|
[3a4ae6c] | 257 | |
---|
[3a659b04] | 258 | /** |
---|
| 259 | * @brief Terminates the system with an INTERNAL_ERROR_CORE fatal source and |
---|
| 260 | * the specified core error code. |
---|
| 261 | * |
---|
[5ad74fd6] | 262 | * @param core_error The core error code. |
---|
[3a659b04] | 263 | * |
---|
| 264 | * @see _Terminate(). |
---|
| 265 | */ |
---|
[d7a48e1] | 266 | RTEMS_NO_RETURN void _Internal_error( Internal_errors_Core_list core_error ); |
---|
[3a659b04] | 267 | |
---|
[3a4ae6c] | 268 | #ifdef __cplusplus |
---|
| 269 | } |
---|
| 270 | #endif |
---|
| 271 | |
---|
[5ad74fd6] | 272 | /** @} */ |
---|
[baff4da] | 273 | |
---|
[3a4ae6c] | 274 | #endif |
---|
[b10825c] | 275 | /* end of include file */ |
---|