Debian Codegraph @

gcc/ada/libgnat/s-soflin.adb

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . S O F T _ L I N K S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2025, Free Software Foundation, Inc. --
10 -- --
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. --
17 -- --
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. --
21 -- --
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/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 pragma Warnings (Off);
33 -- Disable warnings as System.Soft_Links.Initialize is not Preelaborate. It is
34 -- safe to with this unit as its elaboration routine will only be initializing
35 -- NT_TSD, which is part of this package spec.
36 with System.Soft_Links.Initialize;
37 pragma Warnings (On);
38
39 package body System.Soft_Links is
40
41 Stack_Limit : aliased System.Address := System.Null_Address;
42 pragma Export (C, Stack_Limit, "__gnat_stack_limit");
43 -- Needed for Vx6Cert (Vx653mc) GOS cert and ravenscar-cert runtimes,
44 -- VxMILS cert, ravenscar-cert and full runtimes, Vx 5 default runtime
45
46 --------------------
47 -- Abort_Defer_NT --
48 --------------------
49
50 procedure Abort_Defer_NT is
51 begin
52 null;
53 end Abort_Defer_NT;
54
55 ----------------------
56 -- Abort_Handler_NT --
57 ----------------------
58
59 procedure Abort_Handler_NT is
60 begin
61 null;
62 end Abort_Handler_NT;
63
64 ----------------------
65 -- Abort_Undefer_NT --
66 ----------------------
67
68 procedure Abort_Undefer_NT is
69 begin
70 null;
71 end Abort_Undefer_NT;
72
73 -----------------
74 -- Adafinal_NT --
75 -----------------
76
77 procedure Adafinal_NT is
78 begin
79 -- Handle normal task termination by the environment task, but only
80 -- for the normal task termination. In the case of Abnormal and
81 -- Unhandled_Exception they must have been handled before, and the
82 -- task termination soft link must have been changed so the task
83 -- termination routine is not executed twice.
84
85 Task_Termination_Handler.all (Ada.Exceptions.Null_Occurrence);
86
87 -- Finalize all library-level controlled objects if needed
88
89 if Finalize_Library_Objects /= null then
90 Finalize_Library_Objects.all;
91 end if;
92 end Adafinal_NT;
93
94 ---------------------------
95 -- Check_Abort_Status_NT --
96 ---------------------------
97
98 function Check_Abort_Status_NT return Integer is
99 begin
100 return Boolean'Pos (False);
101 end Check_Abort_Status_NT;
102
103 ------------------------
104 -- Complete_Master_NT --
105 ------------------------
106
107 procedure Complete_Master_NT is
108 begin
109 null;
110 end Complete_Master_NT;
111
112 ----------------
113 -- Create_TSD --
114 ----------------
115
116 procedure Create_TSD
117 (New_TSD : in out TSD;
118 Sec_Stack : SST.SS_Stack_Ptr;
119 Sec_Stack_Size : System.Parameters.Size_Type)
120 is
121 begin
122 New_TSD.Jmpbuf_Address := Null_Address;
123
124 New_TSD.Sec_Stack_Ptr := Sec_Stack;
125 SST.SS_Init (New_TSD.Sec_Stack_Ptr, Sec_Stack_Size);
126 end Create_TSD;
127
128 -----------------------
129 -- Current_Master_NT --
130 -----------------------
131
132 function Current_Master_NT return Integer is
133 begin
134 return 0;
135 end Current_Master_NT;
136
137 -----------------
138 -- Destroy_TSD --
139 -----------------
140
141 procedure Destroy_TSD (Old_TSD : in out TSD) is
142 begin
143 SST.SS_Free (Old_TSD.Sec_Stack_Ptr);
144 end Destroy_TSD;
145
146 ---------------------
147 -- Enter_Master_NT --
148 ---------------------
149
150 procedure Enter_Master_NT is
151 begin
152 null;
153 end Enter_Master_NT;
154
155 --------------------------
156 -- Get_Current_Excep_NT --
157 --------------------------
158
159 function Get_Current_Excep_NT return EOA is
160 begin
161 return NT_TSD.Current_Excep'Access;
162 end Get_Current_Excep_NT;
163
164 ------------------------
165 -- Get_GNAT_Exception --
166 ------------------------
167
168 function Get_GNAT_Exception return Ada.Exceptions.Exception_Id is
169 begin
170 return Ada.Exceptions.Exception_Identity (Get_Current_Excep.all.all);
171 end Get_GNAT_Exception;
172
173 ---------------------------
174 -- Get_Jmpbuf_Address_NT --
175 ---------------------------
176
177 function Get_Jmpbuf_Address_NT return Address is
178 begin
179 return NT_TSD.Jmpbuf_Address;
180 end Get_Jmpbuf_Address_NT;
181
182 -----------------------------
183 -- Get_Jmpbuf_Address_Soft --
184 -----------------------------
185
186 function Get_Jmpbuf_Address_Soft return Address is
187 begin
188 return Get_Jmpbuf_Address.all;
189 end Get_Jmpbuf_Address_Soft;
190
191 ----------------------
192 -- Get_Sec_Stack_NT --
193 ----------------------
194
195 function Get_Sec_Stack_NT return SST.SS_Stack_Ptr is
196 begin
197 return NT_TSD.Sec_Stack_Ptr;
198 end Get_Sec_Stack_NT;
199
200 -----------------------------
201 -- Get_Sec_Stack_Soft --
202 -----------------------------
203
204 function Get_Sec_Stack_Soft return SST.SS_Stack_Ptr is
205 begin
206 return Get_Sec_Stack.all;
207 end Get_Sec_Stack_Soft;
208
209 -----------------------
210 -- Get_Stack_Info_NT --
211 -----------------------
212
213 function Get_Stack_Info_NT return Stack_Checking.Stack_Access is
214 begin
215 return NT_TSD.Pri_Stack_Info'Access;
216 end Get_Stack_Info_NT;
217
218 -----------------------------
219 -- Save_Library_Occurrence --
220 -----------------------------
221
222 procedure Save_Library_Occurrence (E : EOA) is
223 use Ada.Exceptions;
224 begin
225 if not Library_Exception_Set then
226 Library_Exception_Set := True;
227 if E /= null then
228 Ada.Exceptions.Save_Occurrence (Library_Exception, E.all);
229 end if;
230 end if;
231 end Save_Library_Occurrence;
232
233 ---------------------------
234 -- Set_Jmpbuf_Address_NT --
235 ---------------------------
236
237 procedure Set_Jmpbuf_Address_NT (Addr : Address) is
238 begin
239 NT_TSD.Jmpbuf_Address := Addr;
240 end Set_Jmpbuf_Address_NT;
241
242 procedure Set_Jmpbuf_Address_Soft (Addr : Address) is
243 begin
244 Set_Jmpbuf_Address (Addr);
245 end Set_Jmpbuf_Address_Soft;
246
247 ----------------------
248 -- Set_Sec_Stack_NT --
249 ----------------------
250
251 procedure Set_Sec_Stack_NT (Stack : SST.SS_Stack_Ptr) is
252 begin
253 NT_TSD.Sec_Stack_Ptr := Stack;
254 end Set_Sec_Stack_NT;
255
256 ------------------------
257 -- Set_Sec_Stack_Soft --
258 ------------------------
259
260 procedure Set_Sec_Stack_Soft (Stack : SST.SS_Stack_Ptr) is
261 begin
262 Set_Sec_Stack (Stack);
263 end Set_Sec_Stack_Soft;
264
265 ------------------
266 -- Task_Lock_NT --
267 ------------------
268
269 procedure Task_Lock_NT is
270 begin
271 null;
272 end Task_Lock_NT;
273
274 ------------------
275 -- Task_Name_NT --
276 -------------------
277
278 function Task_Name_NT return String is
279 begin
280 return "main_task";
281 end Task_Name_NT;
282
283 -------------------------
284 -- Task_Termination_NT --
285 -------------------------
286
287 procedure Task_Termination_NT (Excep : EO) is
288 pragma Unreferenced (Excep);
289 begin
290 null;
291 end Task_Termination_NT;
292
293 --------------------
294 -- Task_Unlock_NT --
295 --------------------
296
297 procedure Task_Unlock_NT is
298 begin
299 null;
300 end Task_Unlock_NT;
301 end System.Soft_Links;