RTEMS
exinit.c
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2014.
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 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
22 #include <rtems/config.h>
23 #include <rtems/extensionimpl.h>
24 #include <rtems/init.h>
25 #include <rtems/sysinit.h>
26 #include <rtems/score/sysstate.h>
27 
28 #include <rtems/score/copyrt.h>
29 #include <rtems/score/heap.h>
30 #include <rtems/score/interr.h>
31 #include <rtems/score/isr.h>
32 #include <rtems/score/percpudata.h>
33 #include <rtems/score/priority.h>
35 #include <rtems/score/smpimpl.h>
37 #include <rtems/score/threadimpl.h>
38 #include <rtems/score/todimpl.h>
39 #include <rtems/score/wkspace.h>
40 
41 RTEMS_SECTION(".rtemsroset.copyright") const char _Copyright_Notice[] =
42  "Copyright (C) 1989, 2020 RTEMS Project and contributors";
43 
44 static Objects_Information *
45 _Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
46 
47 static Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
48 
49 static Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
50 
51 Objects_Information ** const
53  NULL,
54  &_Internal_Objects[ 0 ],
55  &_RTEMS_Objects[ 0 ],
56  &_POSIX_Objects[ 0 ]
57 };
58 
59 RTEMS_LINKER_RWSET(
60  _Per_CPU_Data,
61 #if defined(RTEMS_SMP)
62  /*
63  * In SMP configurations, prevent false cache line sharing of per-processor
64  * data with a proper alignment.
65  */
66  RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
67 #endif
68  char
69 );
70 
71 static void rtems_initialize_data_structures(void)
72 {
73  /*
74  * Dispatching and interrupts are disabled until the end of the
75  * initialization sequence. This prevents an inadvertent context
76  * switch before the executive is initialized.
77  *
78  * WARNING: Interrupts should have been disabled by the BSP and
79  * are disabled by boot_card().
80  */
81 
82  /*
83  * Initialize any target architecture specific support as early as possible
84  */
86 
88 
90 
92 
94 
96 }
97 
98 RTEMS_LINKER_ROSET( _Sysinit, rtems_sysinit_item );
99 
100 RTEMS_SYSINIT_ITEM(
101  rtems_initialize_data_structures,
102  RTEMS_SYSINIT_DATA_STRUCTURES,
103  RTEMS_SYSINIT_ORDER_MIDDLE
104 );
105 
106 /*
107  * No threads should be created before this point!!!
108  * _Thread_Executing and _Thread_Heir are not set.
109  *
110  * At this point all API extensions are in place. After the call to
111  * _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.
112  *
113  * Scheduling can properly occur afterwards as long as we avoid dispatching.
114  */
115 RTEMS_SYSINIT_ITEM(
117  RTEMS_SYSINIT_IDLE_THREADS,
118  RTEMS_SYSINIT_ORDER_MIDDLE
119 );
120 
122 {
123  const rtems_sysinit_item *item;
124 
125  /* Invoke the registered system initialization handlers */
126  RTEMS_LINKER_SET_FOREACH( _Sysinit, item ) {
127  ( *item->handler )();
128  }
129 
131 
133 
135 
136  /*******************************************************************
137  *******************************************************************
138  *******************************************************************
139  ****** APPLICATION RUNS HERE ******
140  ****** THE FUNCTION NEVER RETURNS ******
141  *******************************************************************
142  *******************************************************************
143  *******************************************************************/
144 }
Constants and Prototypes Related to the Internal Error Handler.
#define OBJECTS_RTEMS_CLASSES_LAST
Definition: objectimpl.h:54
void _SMP_Handler_initialize(void)
Initializes SMP Handler.
Definition: smp.c:113
#define OBJECTS_APIS_LAST
Definition: object.h:183
This header file defines the Initialization Manager API.
Data Related to the Management of Processor Interrupt Levels.
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
Copyright Notice for RTEMS.
static __inline__ void _System_state_Set(System_state_Codes state)
Sets the current system state to the given state.
Definition: sysstate.h:78
Inlined Routines Associated with the Manipulation of the Scheduler.
static __inline__ void _Thread_Dispatch_initialization(void)
Thread dispatch initialization.
This header file defines parts of the application configuration information API.
void _Scheduler_Handler_initialization(void)
Initializes the scheduler to the policy chosen by the user.
Definition: scheduler.c:24
Heap Handler API.
The system is up and operating normally.
Definition: sysstate.h:55
Classic User Extensions Implementation.
void rtems_initialize_executive(void)
Initializes the system and starts multitasking.
Definition: exinit.c:121
#define RTEMS_ALIGNED(_alignment)
Instructs the compiler in a declaration or definition to enforce the specified alignment.
Definition: basedefs.h:389
void _Thread_Start_multitasking(void) RTEMS_NO_RETURN
Starts thread multitasking.
void _Thread_Create_idle(void)
Creates idle thread.
void _CPU_Initialize(void)
SPARC specific initialization.
Definition: cpu.c:176
Priority Handler API.
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
const char _Copyright_Notice[]
Time of Day Handler API.
void _SMP_Request_start_multitasking(void)
Requests a multitasking start on all configured and available processors.
Definition: smp.c:154
void _ISR_Handler_initialization(void)
Initializes the ISR handler.
Definition: isr.c:36
Definition of custom per-CPU items.
System State Handler API.
Inlined Routines from the Thread Handler.
#define RTEMS_SECTION(_section)
Instructs the compiler to place a specific variable or function in the specified section.
Definition: basedefs.h:817
void _Thread_Handler_initialization(void)
Initializes thread handler.
Definition: thread.c:58
#define OBJECTS_INTERNAL_CLASSES_LAST
Definition: objectimpl.h:51
#define OBJECTS_POSIX_CLASSES_LAST
Definition: objectimpl.h:57
Information Related to the RAM Workspace.
Timecounter API.
SuperCore SMP Implementation.