1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . S O F T _ L I N K S --
9 -- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 pragma Compiler_Unit_Warning
;
35 -- We must turn polling off for this unit, because otherwise we get an
36 -- infinite loop from the code within the Poll routine itself.
38 with System
.Parameters
;
40 pragma Warnings
(Off
);
41 -- Disable warnings since System.Secondary_Stack is currently not Preelaborate
42 with System
.Secondary_Stack
;
45 package body System
.Soft_Links
is
47 package SST
renames System
.Secondary_Stack
;
50 -- Note: we rely on the default initialization of NT_TSD
52 -- Needed for Vx6Cert (Vx653mc) GOS cert and ravenscar-cert runtimes,
53 -- VxMILS cert, ravenscar-cert and full runtimes, Vx 5 default runtime
54 Stack_Limit
: aliased System
.Address
:= System
.Null_Address
;
56 pragma Export
(C
, Stack_Limit
, "__gnat_stack_limit");
62 procedure Abort_Defer_NT
is
67 ----------------------
68 -- Abort_Handler_NT --
69 ----------------------
71 procedure Abort_Handler_NT
is
76 ----------------------
77 -- Abort_Undefer_NT --
78 ----------------------
80 procedure Abort_Undefer_NT
is
89 procedure Adafinal_NT
is
91 -- Handle normal task termination by the environment task, but only
92 -- for the normal task termination. In the case of Abnormal and
93 -- Unhandled_Exception they must have been handled before, and the
94 -- task termination soft link must have been changed so the task
95 -- termination routine is not executed twice.
97 Task_Termination_Handler
.all (Ada
.Exceptions
.Null_Occurrence
);
99 -- Finalize all library-level controlled objects if needed
101 if Finalize_Library_Objects
/= null then
102 Finalize_Library_Objects
.all;
106 ---------------------------
107 -- Check_Abort_Status_NT --
108 ---------------------------
110 function Check_Abort_Status_NT
return Integer is
112 return Boolean'Pos (False);
113 end Check_Abort_Status_NT
;
115 ------------------------
116 -- Complete_Master_NT --
117 ------------------------
119 procedure Complete_Master_NT
is
122 end Complete_Master_NT
;
128 procedure Create_TSD
(New_TSD
: in out TSD
) is
130 SS_Ratio_Dynamic
: constant Boolean := Sec_Stack_Percentage
= Dynamic
;
132 if SS_Ratio_Dynamic
then
134 (New_TSD
.Sec_Stack_Addr
, SST
.Default_Secondary_Stack_Size
);
138 -----------------------
139 -- Current_Master_NT --
140 -----------------------
142 function Current_Master_NT
return Integer is
145 end Current_Master_NT
;
151 procedure Destroy_TSD
(Old_TSD
: in out TSD
) is
153 SST
.SS_Free
(Old_TSD
.Sec_Stack_Addr
);
156 ---------------------
157 -- Enter_Master_NT --
158 ---------------------
160 procedure Enter_Master_NT
is
165 --------------------------
166 -- Get_Current_Excep_NT --
167 --------------------------
169 function Get_Current_Excep_NT
return EOA
is
171 return NT_TSD
.Current_Excep
'Access;
172 end Get_Current_Excep_NT
;
174 ------------------------
175 -- Get_GNAT_Exception --
176 ------------------------
178 function Get_GNAT_Exception
return Ada
.Exceptions
.Exception_Id
is
180 return Ada
.Exceptions
.Exception_Identity
(Get_Current_Excep
.all.all);
181 end Get_GNAT_Exception
;
183 ---------------------------
184 -- Get_Jmpbuf_Address_NT --
185 ---------------------------
187 function Get_Jmpbuf_Address_NT
return Address
is
189 return NT_TSD
.Jmpbuf_Address
;
190 end Get_Jmpbuf_Address_NT
;
192 -----------------------------
193 -- Get_Jmpbuf_Address_Soft --
194 -----------------------------
196 function Get_Jmpbuf_Address_Soft
return Address
is
198 return Get_Jmpbuf_Address
.all;
199 end Get_Jmpbuf_Address_Soft
;
201 ---------------------------
202 -- Get_Sec_Stack_Addr_NT --
203 ---------------------------
205 function Get_Sec_Stack_Addr_NT
return Address
is
207 return NT_TSD
.Sec_Stack_Addr
;
208 end Get_Sec_Stack_Addr_NT
;
210 -----------------------------
211 -- Get_Sec_Stack_Addr_Soft --
212 -----------------------------
214 function Get_Sec_Stack_Addr_Soft
return Address
is
216 return Get_Sec_Stack_Addr
.all;
217 end Get_Sec_Stack_Addr_Soft
;
219 -----------------------
220 -- Get_Stack_Info_NT --
221 -----------------------
223 function Get_Stack_Info_NT
return Stack_Checking
.Stack_Access
is
225 return NT_TSD
.Pri_Stack_Info
'Access;
226 end Get_Stack_Info_NT
;
228 -----------------------------
229 -- Save_Library_Occurrence --
230 -----------------------------
232 procedure Save_Library_Occurrence
(E
: EOA
) is
235 if not Library_Exception_Set
then
236 Library_Exception_Set
:= True;
238 Ada
.Exceptions
.Save_Occurrence
(Library_Exception
, E
.all);
241 end Save_Library_Occurrence
;
243 ---------------------------
244 -- Set_Jmpbuf_Address_NT --
245 ---------------------------
247 procedure Set_Jmpbuf_Address_NT
(Addr
: Address
) is
249 NT_TSD
.Jmpbuf_Address
:= Addr
;
250 end Set_Jmpbuf_Address_NT
;
252 procedure Set_Jmpbuf_Address_Soft
(Addr
: Address
) is
254 Set_Jmpbuf_Address
(Addr
);
255 end Set_Jmpbuf_Address_Soft
;
257 ---------------------------
258 -- Set_Sec_Stack_Addr_NT --
259 ---------------------------
261 procedure Set_Sec_Stack_Addr_NT
(Addr
: Address
) is
263 NT_TSD
.Sec_Stack_Addr
:= Addr
;
264 end Set_Sec_Stack_Addr_NT
;
266 -----------------------------
267 -- Set_Sec_Stack_Addr_Soft --
268 -----------------------------
270 procedure Set_Sec_Stack_Addr_Soft
(Addr
: Address
) is
272 Set_Sec_Stack_Addr
(Addr
);
273 end Set_Sec_Stack_Addr_Soft
;
279 procedure Task_Lock_NT
is
288 function Task_Name_NT
return String is
293 -------------------------
294 -- Task_Termination_NT --
295 -------------------------
297 procedure Task_Termination_NT
(Excep
: EO
) is
298 pragma Unreferenced
(Excep
);
301 end Task_Termination_NT
;
307 procedure Task_Unlock_NT
is
312 end System
.Soft_Links
;