-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathenvironment_task.adb
97 lines (89 loc) · 3.9 KB
/
environment_task.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
-- Copyright (C) 2016-2018 Free Software Foundation, Inc.
--
-- This file is part of the FreeRTOS-Ada project. This file is
-- free software; you can redistribute it and/or modify it under
-- terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any
-- later version. This file is distributed in the hope that it will
-- be useful, but WITHOUT ANY WARRANTY; without even the implied
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
-- As a special exception under Section 7 of GPL version 3, you are
-- granted additional permissions described in the GCC Runtime
-- Library Exception, version 3.1, as published by the Free Software
-- Foundation.
--
-- You should have received a copy of the GNU General Public License
-- and a copy of the GCC Runtime Library Exception along with this
-- program; see the files COPYING3 and COPYING.RUNTIME respectively.
-- If not, see <http://www.gnu.org/licenses/>.
with System.Parameters;
with System.Tasking.Restricted.Stages;
with System.Task_Info;
package body Environment_Task is
procedure Environment_Task (Arg : System.Address);
procedure Environment_Task (Arg : System.Address) is
pragma Unreferenced (Arg);
-- Generated by gnatbind.
procedure Main
with
Import,
Convention => C,
External_Name => "main";
begin
Main; -- should not return;
end Environment_Task;
-- For creating the environment task; declared here to avoid
-- accessibility level issues.
Environment_Task_Elaborated : aliased Boolean;
Activation_Chain_Dummy : System.Tasking.Activation_Chain
with Suppress_Initialization;
Environment_TCB : aliased System.Tasking.Ada_Task_Control_Block
(System.Tasking.Null_Entry);
-- If the link includes a symbol _environment_task_storage_size,
-- use this as the storage size: otherwise, use 1536.
Environment_Task_Storage_Size : constant System.Parameters.Size_Type
with
Import,
Convention => Ada,
External_Name => "_environment_task_storage_size";
pragma Weak_External (Environment_Task_Storage_Size);
-- If the link includes a symbol _environment_task_secondary_stack_size,
-- use this as the secondary stack size: otherwise, use the default.
Environment_Task_Secondary_Stack_Size :
constant System.Parameters.Size_Type
with
Import,
Convention => Ada,
External_Name => "_environment_task_secondary_stack_size";
pragma Weak_External (Environment_Task_Secondary_Stack_Size);
procedure Create is
-- Will be overwritten by binder-generated code if the main
-- program has pragma Priority.
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
use type System.Address;
begin
System.Tasking.Restricted.Stages.Create_Restricted_Task
(Priority => Main_Priority,
Stack_Address => System.Null_Address,
Size =>
(if Environment_Task_Storage_Size'Address = System.Null_Address
then 1536
else Environment_Task_Storage_Size),
Sec_Stack_Address => null,
Secondary_Stack_Size =>
(if Environment_Task_Secondary_Stack_Size'Address
= System.Null_Address
then System.Parameters.Unspecified_Size
else Environment_Task_Secondary_Stack_Size),
Task_Info => System.Task_Info.Unspecified_Task_Info,
CPU => System.Tasking.Unspecified_CPU,
State => Environment_Task'Access,
Discriminants => System.Null_Address,
Elaborated => Environment_Task_Elaborated'Access,
Chain => Activation_Chain_Dummy,
Task_Image => "",
Created_Task => Environment_TCB'Access);
end Create;
end Environment_Task;