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 | |
---|
24 | /* |
---|
25 | * Conditional magic to determine what style of C++ constructor |
---|
26 | * initialization this target and compiler version uses. |
---|
27 | */ |
---|
28 | #if defined(__USE_INIT_FINI__) |
---|
29 | #if defined(__ARM_EABI__) |
---|
30 | #define INIT_NAME __libc_init_array |
---|
31 | #else |
---|
32 | #define INIT_NAME _init |
---|
33 | #endif |
---|
34 | |
---|
35 | extern void INIT_NAME(void); |
---|
36 | #define EXECUTE_GLOBAL_CONSTRUCTORS |
---|
37 | #endif |
---|
38 | |
---|
39 | #if defined(__USE__MAIN__) |
---|
40 | extern void __main(void); |
---|
41 | #define INIT_NAME __main |
---|
42 | #define EXECUTE_GLOBAL_CONSTRUCTORS |
---|
43 | #endif |
---|
44 | |
---|
45 | void _Thread_Global_construction( |
---|
46 | Thread_Control *executing, |
---|
47 | const Thread_Entry_information *entry |
---|
48 | ) |
---|
49 | { |
---|
50 | ISR_lock_Context lock_context; |
---|
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 | _ISR_lock_ISR_disable( &lock_context ); |
---|
62 | _Thread_Restart_self( _Thread_Executing, entry, &lock_context ); |
---|
63 | } |
---|