1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Thread Global Construction |
---|
5 | * |
---|
6 | * @ingroup ScoreThread |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2012. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/score/threadimpl.h> |
---|
23 | #include <rtems/score/assert.h> |
---|
24 | #include <rtems/config.h> |
---|
25 | |
---|
26 | /* |
---|
27 | * Conditional magic to determine what style of C++ constructor |
---|
28 | * initialization this target and compiler version uses. |
---|
29 | */ |
---|
30 | #if defined(__USE_INIT_FINI__) |
---|
31 | #if defined(__ARM_EABI__) |
---|
32 | #define INIT_NAME __libc_init_array |
---|
33 | #else |
---|
34 | #define INIT_NAME _init |
---|
35 | #endif |
---|
36 | |
---|
37 | extern void INIT_NAME(void); |
---|
38 | #define EXECUTE_GLOBAL_CONSTRUCTORS |
---|
39 | #endif |
---|
40 | |
---|
41 | #if defined(__USE__MAIN__) |
---|
42 | extern void __main(void); |
---|
43 | #define INIT_NAME __main |
---|
44 | #define EXECUTE_GLOBAL_CONSTRUCTORS |
---|
45 | #endif |
---|
46 | |
---|
47 | void _Thread_Global_construction( |
---|
48 | Thread_Control *executing, |
---|
49 | const Thread_Entry_information *entry |
---|
50 | ) |
---|
51 | { |
---|
52 | #if defined(EXECUTE_GLOBAL_CONSTRUCTORS) |
---|
53 | /* |
---|
54 | * _init could be a weak symbol and we SHOULD test it but it isn't |
---|
55 | * in any configuration I know of and it generates a warning on every |
---|
56 | * RTEMS target configuration. --joel (12 May 2007) |
---|
57 | */ |
---|
58 | INIT_NAME(); |
---|
59 | #endif |
---|
60 | |
---|
61 | _Thread_Disable_dispatch(); |
---|
62 | _Thread_Restart( executing, executing, entry ); |
---|
63 | _Thread_Enable_dispatch(); |
---|
64 | RTEMS_UNREACHABLE(); |
---|
65 | } |
---|