1- -- -*- ada -*-
2-
31------------------------------------------------------------------------------
42-- --
53-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4745
4846-- Modified for the Cortex GNAT RTS, by leaving out parts that aren't
4947-- called.
48+ --
49+ -- If the user compiles with Partition_Elaboration_Policy set to
50+ -- Sequential, the compiled code calls
51+ -- Create_Restricted_Task_Sequential instead of
52+ -- Create_Restricted_Task, and at the end calls
53+ -- Activate_All_Tasks_Sequential. This RTS only actually supports
54+ -- Concurrent activation (that is, each task is activated as soon as
55+ -- it's created), and so Create_Restricted_Task_Sequential just calls
56+ -- Create_Restricted_Task (with a dummy Chain, which
57+ -- Create_Restricted_Task ignores anyway, since FreeRTOS doesn't
58+ -- provide a way to create a task without activating it).
5059
5160pragma Restrictions (No_Elaboration_Code);
5261
@@ -56,18 +65,30 @@ with System.Task_Info;
5665package System.Tasking.Restricted.Stages is
5766 pragma Preelaborate;
5867
68+ Partition_Elaboration_Policy : Character := 'C';
69+ pragma Export (C, Partition_Elaboration_Policy,
70+ "__gnat_partition_elaboration_policy");
71+ -- Partition elaboration policy. Value can be either 'C' for
72+ -- concurrent, which is the default or 'S' for sequential. This
73+ -- value can be modified by the binder generated code in
74+ -- adainit(), before calling elaboration code, if task activation
75+ -- is supposed to be Sequential. Unfortunately, that's too late
76+ -- for this RTS. The variable is provided because the
77+ -- binder-generated code expects it if the user has specified
78+ -- sequential elaboration.
79+
5980 procedure Create_Restricted_Task
60- (Priority : Integer;
61- Stack_Address : System.Address;
62- Size : System.Parameters.Size_Type;
63- Task_Info : System.Task_Info.Task_Info_Type;
64- CPU : Integer;
65- State : Task_Procedure_Access;
66- Discriminants : System.Address;
67- Elaborated : Access_Boolean;
68- Chain : in out Activation_Chain;
69- Task_Image : String;
70- Created_Task : Task_Id);
81+ (Priority : Integer;
82+ Stack_Address : System.Address;
83+ Size : System.Parameters.Size_Type;
84+ Task_Info : System.Task_Info.Task_Info_Type;
85+ CPU : Integer;
86+ State : Task_Procedure_Access;
87+ Discriminants : System.Address;
88+ Elaborated : Access_Boolean;
89+ Chain : in out Activation_Chain;
90+ Task_Image : String;
91+ Created_Task : Task_Id);
7192 -- Compiler interface only. Do not call from within the RTS. This
7293 -- must be called to create a new task, when the partition
7394 -- elaboration policy is not specified (or is concurrent).
@@ -114,6 +135,25 @@ package System.Tasking.Restricted.Stages is
114135 -- This procedure can raise Storage_Error if the task creation
115136 -- fails
116137
138+ procedure Create_Restricted_Task_Sequential
139+ (Priority : Integer;
140+ Stack_Address : System.Address;
141+ Size : System.Parameters.Size_Type;
142+ Task_Info : System.Task_Info.Task_Info_Type;
143+ CPU : Integer;
144+ State : Task_Procedure_Access;
145+ Discriminants : System.Address;
146+ Elaborated : Access_Boolean;
147+ Task_Image : String;
148+ Created_Task : Task_Id);
149+ -- Compiler interface only. Do not call from within the RTS.
150+ -- This must be called to create a new task, when the sequential partition
151+ -- elaboration policy is used.
152+ --
153+ -- The parameters are the same as Create_Restricted_Task except there is
154+ -- no Chain parameter (for the activation chain), as there is only one
155+ -- global activation chain, which is declared in the body of this package.
156+
117157 procedure Activate_Restricted_Tasks
118158 (Chain_Access : Activation_Chain_Access);
119159 -- Compiler interface only. Do not call from within the RTS. This
@@ -135,6 +175,13 @@ package System.Tasking.Restricted.Stages is
135175 -- procedure does nothing, tasks will be activated at end of
136176 -- elaboration.
137177
178+ procedure Activate_All_Tasks_Sequential;
179+ pragma Export (C, Activate_All_Tasks_Sequential,
180+ "__gnat_activate_all_tasks");
181+ -- Binder interface only. Do not call from within the RTS. This must be
182+ -- called an the end of the elaboration to activate all tasks, in order
183+ -- to implement the sequential elaboration policy.
184+
138185 procedure Complete_Restricted_Activation;
139186 -- Compiler interface only. Do not call from within the RTS. This
140187 -- should be called from the task body at the end of the
0 commit comments