1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . S O F T _ L I N K S --
10 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 ------------------------------------------------------------------------------
36 -- We must turn polling off for this unit, because otherwise we get
37 -- an infinite loop from the code within the Poll routine itself.
39 with System
.Machine_State_Operations
; use System
.Machine_State_Operations
;
40 -- Used for Create_TSD, Destroy_TSD
42 with System
.Parameters
;
43 -- Used for Sec_Stack_Ratio
45 with System
.Secondary_Stack
;
47 package body System
.Soft_Links
is
49 package SST
renames System
.Secondary_Stack
;
51 -- Allocate an exception stack for the main program to use.
52 -- We make sure that the stack has maximum alignment. Some systems require
53 -- this (e.g. Sun), and in any case it is a good idea for efficiency.
55 NT_Exc_Stack
: array (0 .. 8192) of aliased Character;
56 for NT_Exc_Stack
'Alignment use Standard
'Maximum_Alignment;
64 procedure Abort_Defer_NT
is
69 ----------------------
70 -- Abort_Handler_NT --
71 ----------------------
73 procedure Abort_Handler_NT
is
78 ----------------------
79 -- Abort_Undefer_NT --
80 ----------------------
82 procedure Abort_Undefer_NT
is
87 ---------------------------
88 -- Check_Abort_Status_NT --
89 ---------------------------
91 function Check_Abort_Status_NT
return Integer is
93 return Boolean'Pos (False);
94 end Check_Abort_Status_NT
;
96 ------------------------
97 -- Complete_Master_NT --
98 ------------------------
100 procedure Complete_Master_NT
is
103 end Complete_Master_NT
;
109 procedure Create_TSD
(New_TSD
: in out TSD
) is
110 use type Parameters
.Size_Type
;
112 SS_Ratio_Dynamic
: constant Boolean :=
113 Parameters
.Sec_Stack_Ratio
= Parameters
.Dynamic
;
116 if SS_Ratio_Dynamic
then
118 (New_TSD
.Sec_Stack_Addr
, SST
.Default_Secondary_Stack_Size
);
121 New_TSD
.Machine_State_Addr
:=
123 (System
.Machine_State_Operations
.Allocate_Machine_State
);
126 -----------------------
127 -- Current_Master_NT --
128 -----------------------
130 function Current_Master_NT
return Integer is
133 end Current_Master_NT
;
139 procedure Destroy_TSD
(Old_TSD
: in out TSD
) is
141 SST
.SS_Free
(Old_TSD
.Sec_Stack_Addr
);
142 System
.Machine_State_Operations
.Free_Machine_State
143 (Machine_State
(Old_TSD
.Machine_State_Addr
));
146 ---------------------
147 -- Enter_Master_NT --
148 ---------------------
150 procedure Enter_Master_NT
is
155 --------------------------
156 -- Get_Current_Excep_NT --
157 --------------------------
159 function Get_Current_Excep_NT
return EOA
is
161 return NT_TSD
.Current_Excep
'Access;
162 end Get_Current_Excep_NT
;
164 ---------------------------
165 -- Get_Exc_Stack_Addr_NT --
166 ---------------------------
168 function Get_Exc_Stack_Addr_NT
return Address
is
170 return NT_TSD
.Exc_Stack_Addr
;
171 end Get_Exc_Stack_Addr_NT
;
173 -----------------------------
174 -- Get_Exc_Stack_Addr_Soft --
175 -----------------------------
177 function Get_Exc_Stack_Addr_Soft
return Address
is
179 return Get_Exc_Stack_Addr
.all;
180 end Get_Exc_Stack_Addr_Soft
;
182 ------------------------
183 -- Get_GNAT_Exception --
184 ------------------------
186 function Get_GNAT_Exception
return Ada
.Exceptions
.Exception_Id
is
188 return Ada
.Exceptions
.Exception_Identity
(Get_Current_Excep
.all.all);
189 end Get_GNAT_Exception
;
191 ---------------------------
192 -- Get_Jmpbuf_Address_NT --
193 ---------------------------
195 function Get_Jmpbuf_Address_NT
return Address
is
197 return NT_TSD
.Jmpbuf_Address
;
198 end Get_Jmpbuf_Address_NT
;
200 -----------------------------
201 -- Get_Jmpbuf_Address_Soft --
202 -----------------------------
204 function Get_Jmpbuf_Address_Soft
return Address
is
206 return Get_Jmpbuf_Address
.all;
207 end Get_Jmpbuf_Address_Soft
;
209 -------------------------------
210 -- Get_Machine_State_Addr_NT --
211 -------------------------------
213 function Get_Machine_State_Addr_NT
return Address
is
215 return NT_TSD
.Machine_State_Addr
;
216 end Get_Machine_State_Addr_NT
;
218 ---------------------------------
219 -- Get_Machine_State_Addr_Soft --
220 ---------------------------------
222 function Get_Machine_State_Addr_Soft
return Address
is
224 return Get_Machine_State_Addr
.all;
225 end Get_Machine_State_Addr_Soft
;
227 ---------------------------
228 -- Get_Sec_Stack_Addr_NT --
229 ---------------------------
231 function Get_Sec_Stack_Addr_NT
return Address
is
233 return NT_TSD
.Sec_Stack_Addr
;
234 end Get_Sec_Stack_Addr_NT
;
236 -----------------------------
237 -- Get_Sec_Stack_Addr_Soft --
238 -----------------------------
240 function Get_Sec_Stack_Addr_Soft
return Address
is
242 return Get_Sec_Stack_Addr
.all;
243 end Get_Sec_Stack_Addr_Soft
;
245 -----------------------
246 -- Get_Stack_Info_NT --
247 -----------------------
249 function Get_Stack_Info_NT
return Stack_Checking
.Stack_Access
is
251 return NT_TSD
.Pri_Stack_Info
'Access;
252 end Get_Stack_Info_NT
;
258 procedure Null_Adafinal
is
263 ---------------------------
264 -- Set_Exc_Stack_Addr_NT --
265 ---------------------------
267 procedure Set_Exc_Stack_Addr_NT
(Self_ID
: Address
; Addr
: Address
) is
268 pragma Warnings
(Off
, Self_ID
);
271 NT_TSD
.Exc_Stack_Addr
:= Addr
;
272 end Set_Exc_Stack_Addr_NT
;
274 -----------------------------
275 -- Set_Exc_Stack_Addr_Soft --
276 -----------------------------
278 procedure Set_Exc_Stack_Addr_Soft
(Self_ID
: Address
; Addr
: Address
) is
280 Set_Exc_Stack_Addr
(Self_ID
, Addr
);
281 end Set_Exc_Stack_Addr_Soft
;
283 ---------------------------
284 -- Set_Jmpbuf_Address_NT --
285 ---------------------------
287 procedure Set_Jmpbuf_Address_NT
(Addr
: Address
) is
289 NT_TSD
.Jmpbuf_Address
:= Addr
;
290 end Set_Jmpbuf_Address_NT
;
292 procedure Set_Jmpbuf_Address_Soft
(Addr
: Address
) is
294 Set_Jmpbuf_Address
(Addr
);
295 end Set_Jmpbuf_Address_Soft
;
297 -------------------------------
298 -- Set_Machine_State_Addr_NT --
299 -------------------------------
301 procedure Set_Machine_State_Addr_NT
(Addr
: Address
) is
303 NT_TSD
.Machine_State_Addr
:= Addr
;
304 end Set_Machine_State_Addr_NT
;
306 ---------------------------------
307 -- Set_Machine_State_Addr_Soft --
308 ---------------------------------
310 procedure Set_Machine_State_Addr_Soft
(Addr
: Address
) is
312 Set_Machine_State_Addr
(Addr
);
313 end Set_Machine_State_Addr_Soft
;
315 ---------------------------
316 -- Set_Sec_Stack_Addr_NT --
317 ---------------------------
319 procedure Set_Sec_Stack_Addr_NT
(Addr
: Address
) is
321 NT_TSD
.Sec_Stack_Addr
:= Addr
;
322 end Set_Sec_Stack_Addr_NT
;
324 -----------------------------
325 -- Set_Sec_Stack_Addr_Soft --
326 -----------------------------
328 procedure Set_Sec_Stack_Addr_Soft
(Addr
: Address
) is
330 Set_Sec_Stack_Addr
(Addr
);
331 end Set_Sec_Stack_Addr_Soft
;
337 procedure Task_Lock_NT
is
346 procedure Task_Unlock_NT
is
351 -------------------------
352 -- Update_Exception_NT --
353 -------------------------
355 procedure Update_Exception_NT
(X
: EO
:= Current_Target_Exception
) is
357 Ada
.Exceptions
.Save_Occurrence
(NT_TSD
.Current_Excep
, X
);
358 end Update_Exception_NT
;
364 function Task_Name_NT
return String is
369 -------------------------
370 -- Package Elaboration --
371 -------------------------
374 NT_TSD
.Exc_Stack_Addr
:= NT_Exc_Stack
(8192)'Address;
375 Ada
.Exceptions
.Save_Occurrence
376 (NT_TSD
.Current_Excep
, Ada
.Exceptions
.Null_Occurrence
);
378 end System
.Soft_Links
;