1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . A U X _ D E C --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1996-2009, 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 |
|
|
-- This package contains definitions that are designed to be compatible
|
33 |
|
|
-- with the extra definitions in package System for DEC Ada implementations.
|
34 |
|
|
|
35 |
|
|
-- These definitions can be used directly by withing this package, or merged
|
36 |
|
|
-- with System using pragma Extend_System (Aux_DEC)
|
37 |
|
|
|
38 |
|
|
with Ada.Unchecked_Conversion;
|
39 |
|
|
|
40 |
|
|
package System.Aux_DEC is
|
41 |
|
|
pragma Preelaborate;
|
42 |
|
|
|
43 |
|
|
subtype Short_Address is Address;
|
44 |
|
|
-- In some versions of System.Aux_DEC, notably that for VMS on the
|
45 |
|
|
-- ia64, there are two address types (64-bit and 32-bit), and the
|
46 |
|
|
-- name Short_Address is used for the short address form. To avoid
|
47 |
|
|
-- difficulties (in regression tests and elsewhere) with units that
|
48 |
|
|
-- reference Short_Address, it is provided for other targets as a
|
49 |
|
|
-- synonym for the normal Address type, and, as in the case where
|
50 |
|
|
-- the lengths are different, Address and Short_Address can be
|
51 |
|
|
-- freely inter-converted.
|
52 |
|
|
|
53 |
|
|
type Integer_8 is range -2 ** (8 - 1) .. +2 ** (8 - 1) - 1;
|
54 |
|
|
for Integer_8'Size use 8;
|
55 |
|
|
|
56 |
|
|
type Integer_16 is range -2 ** (16 - 1) .. +2 ** (16 - 1) - 1;
|
57 |
|
|
for Integer_16'Size use 16;
|
58 |
|
|
|
59 |
|
|
type Integer_32 is range -2 ** (32 - 1) .. +2 ** (32 - 1) - 1;
|
60 |
|
|
for Integer_32'Size use 32;
|
61 |
|
|
|
62 |
|
|
type Integer_64 is range -2 ** (64 - 1) .. +2 ** (64 - 1) - 1;
|
63 |
|
|
for Integer_64'Size use 64;
|
64 |
|
|
|
65 |
|
|
type Integer_8_Array is array (Integer range <>) of Integer_8;
|
66 |
|
|
type Integer_16_Array is array (Integer range <>) of Integer_16;
|
67 |
|
|
type Integer_32_Array is array (Integer range <>) of Integer_32;
|
68 |
|
|
type Integer_64_Array is array (Integer range <>) of Integer_64;
|
69 |
|
|
-- These array types are not in all versions of DEC System, and in fact it
|
70 |
|
|
-- is not quite clear why they are in some and not others, but since they
|
71 |
|
|
-- definitely appear in some versions, we include them unconditionally.
|
72 |
|
|
|
73 |
|
|
type Largest_Integer is range Min_Int .. Max_Int;
|
74 |
|
|
|
75 |
|
|
type AST_Handler is private;
|
76 |
|
|
|
77 |
|
|
No_AST_Handler : constant AST_Handler;
|
78 |
|
|
|
79 |
|
|
type Type_Class is
|
80 |
|
|
(Type_Class_Enumeration,
|
81 |
|
|
Type_Class_Integer,
|
82 |
|
|
Type_Class_Fixed_Point,
|
83 |
|
|
Type_Class_Floating_Point,
|
84 |
|
|
Type_Class_Array,
|
85 |
|
|
Type_Class_Record,
|
86 |
|
|
Type_Class_Access,
|
87 |
|
|
Type_Class_Task, -- also in Ada 95 protected
|
88 |
|
|
Type_Class_Address);
|
89 |
|
|
|
90 |
|
|
function "not" (Left : Largest_Integer) return Largest_Integer;
|
91 |
|
|
function "and" (Left, Right : Largest_Integer) return Largest_Integer;
|
92 |
|
|
function "or" (Left, Right : Largest_Integer) return Largest_Integer;
|
93 |
|
|
function "xor" (Left, Right : Largest_Integer) return Largest_Integer;
|
94 |
|
|
|
95 |
|
|
Address_Zero : constant Address;
|
96 |
|
|
No_Addr : constant Address;
|
97 |
|
|
Address_Size : constant := Standard'Address_Size;
|
98 |
|
|
Short_Address_Size : constant := Standard'Address_Size;
|
99 |
|
|
|
100 |
|
|
function "+" (Left : Address; Right : Integer) return Address;
|
101 |
|
|
function "+" (Left : Integer; Right : Address) return Address;
|
102 |
|
|
function "-" (Left : Address; Right : Address) return Integer;
|
103 |
|
|
function "-" (Left : Address; Right : Integer) return Address;
|
104 |
|
|
|
105 |
|
|
generic
|
106 |
|
|
type Target is private;
|
107 |
|
|
function Fetch_From_Address (A : Address) return Target;
|
108 |
|
|
|
109 |
|
|
generic
|
110 |
|
|
type Target is private;
|
111 |
|
|
procedure Assign_To_Address (A : Address; T : Target);
|
112 |
|
|
|
113 |
|
|
-- Floating point type declarations for VAX floating point data types
|
114 |
|
|
|
115 |
|
|
pragma Warnings (Off);
|
116 |
|
|
-- ??? needs comment
|
117 |
|
|
|
118 |
|
|
type F_Float is digits 6;
|
119 |
|
|
pragma Float_Representation (VAX_Float, F_Float);
|
120 |
|
|
|
121 |
|
|
type D_Float is digits 9;
|
122 |
|
|
pragma Float_Representation (Vax_Float, D_Float);
|
123 |
|
|
|
124 |
|
|
type G_Float is digits 15;
|
125 |
|
|
pragma Float_Representation (Vax_Float, G_Float);
|
126 |
|
|
|
127 |
|
|
-- Floating point type declarations for IEEE floating point data types
|
128 |
|
|
|
129 |
|
|
type IEEE_Single_Float is digits 6;
|
130 |
|
|
pragma Float_Representation (IEEE_Float, IEEE_Single_Float);
|
131 |
|
|
|
132 |
|
|
type IEEE_Double_Float is digits 15;
|
133 |
|
|
pragma Float_Representation (IEEE_Float, IEEE_Double_Float);
|
134 |
|
|
|
135 |
|
|
pragma Warnings (On);
|
136 |
|
|
|
137 |
|
|
Non_Ada_Error : exception;
|
138 |
|
|
|
139 |
|
|
-- Hardware-oriented types and functions
|
140 |
|
|
|
141 |
|
|
type Bit_Array is array (Integer range <>) of Boolean;
|
142 |
|
|
pragma Pack (Bit_Array);
|
143 |
|
|
|
144 |
|
|
subtype Bit_Array_8 is Bit_Array (0 .. 7);
|
145 |
|
|
subtype Bit_Array_16 is Bit_Array (0 .. 15);
|
146 |
|
|
subtype Bit_Array_32 is Bit_Array (0 .. 31);
|
147 |
|
|
subtype Bit_Array_64 is Bit_Array (0 .. 63);
|
148 |
|
|
|
149 |
|
|
type Unsigned_Byte is range 0 .. 255;
|
150 |
|
|
for Unsigned_Byte'Size use 8;
|
151 |
|
|
|
152 |
|
|
function "not" (Left : Unsigned_Byte) return Unsigned_Byte;
|
153 |
|
|
function "and" (Left, Right : Unsigned_Byte) return Unsigned_Byte;
|
154 |
|
|
function "or" (Left, Right : Unsigned_Byte) return Unsigned_Byte;
|
155 |
|
|
function "xor" (Left, Right : Unsigned_Byte) return Unsigned_Byte;
|
156 |
|
|
|
157 |
|
|
function To_Unsigned_Byte (X : Bit_Array_8) return Unsigned_Byte;
|
158 |
|
|
function To_Bit_Array_8 (X : Unsigned_Byte) return Bit_Array_8;
|
159 |
|
|
|
160 |
|
|
type Unsigned_Byte_Array is array (Integer range <>) of Unsigned_Byte;
|
161 |
|
|
|
162 |
|
|
type Unsigned_Word is range 0 .. 65535;
|
163 |
|
|
for Unsigned_Word'Size use 16;
|
164 |
|
|
|
165 |
|
|
function "not" (Left : Unsigned_Word) return Unsigned_Word;
|
166 |
|
|
function "and" (Left, Right : Unsigned_Word) return Unsigned_Word;
|
167 |
|
|
function "or" (Left, Right : Unsigned_Word) return Unsigned_Word;
|
168 |
|
|
function "xor" (Left, Right : Unsigned_Word) return Unsigned_Word;
|
169 |
|
|
|
170 |
|
|
function To_Unsigned_Word (X : Bit_Array_16) return Unsigned_Word;
|
171 |
|
|
function To_Bit_Array_16 (X : Unsigned_Word) return Bit_Array_16;
|
172 |
|
|
|
173 |
|
|
type Unsigned_Word_Array is array (Integer range <>) of Unsigned_Word;
|
174 |
|
|
|
175 |
|
|
type Unsigned_Longword is range -2_147_483_648 .. 2_147_483_647;
|
176 |
|
|
for Unsigned_Longword'Size use 32;
|
177 |
|
|
|
178 |
|
|
function "not" (Left : Unsigned_Longword) return Unsigned_Longword;
|
179 |
|
|
function "and" (Left, Right : Unsigned_Longword) return Unsigned_Longword;
|
180 |
|
|
function "or" (Left, Right : Unsigned_Longword) return Unsigned_Longword;
|
181 |
|
|
function "xor" (Left, Right : Unsigned_Longword) return Unsigned_Longword;
|
182 |
|
|
|
183 |
|
|
function To_Unsigned_Longword (X : Bit_Array_32) return Unsigned_Longword;
|
184 |
|
|
function To_Bit_Array_32 (X : Unsigned_Longword) return Bit_Array_32;
|
185 |
|
|
|
186 |
|
|
type Unsigned_Longword_Array is
|
187 |
|
|
array (Integer range <>) of Unsigned_Longword;
|
188 |
|
|
|
189 |
|
|
type Unsigned_32 is range 0 .. 4_294_967_295;
|
190 |
|
|
for Unsigned_32'Size use 32;
|
191 |
|
|
|
192 |
|
|
function "not" (Left : Unsigned_32) return Unsigned_32;
|
193 |
|
|
function "and" (Left, Right : Unsigned_32) return Unsigned_32;
|
194 |
|
|
function "or" (Left, Right : Unsigned_32) return Unsigned_32;
|
195 |
|
|
function "xor" (Left, Right : Unsigned_32) return Unsigned_32;
|
196 |
|
|
|
197 |
|
|
function To_Unsigned_32 (X : Bit_Array_32) return Unsigned_32;
|
198 |
|
|
function To_Bit_Array_32 (X : Unsigned_32) return Bit_Array_32;
|
199 |
|
|
|
200 |
|
|
type Unsigned_Quadword is record
|
201 |
|
|
L0 : Unsigned_Longword;
|
202 |
|
|
L1 : Unsigned_Longword;
|
203 |
|
|
end record;
|
204 |
|
|
|
205 |
|
|
for Unsigned_Quadword'Size use 64;
|
206 |
|
|
for Unsigned_Quadword'Alignment use
|
207 |
|
|
Integer'Min (8, Standard'Maximum_Alignment);
|
208 |
|
|
|
209 |
|
|
function "not" (Left : Unsigned_Quadword) return Unsigned_Quadword;
|
210 |
|
|
function "and" (Left, Right : Unsigned_Quadword) return Unsigned_Quadword;
|
211 |
|
|
function "or" (Left, Right : Unsigned_Quadword) return Unsigned_Quadword;
|
212 |
|
|
function "xor" (Left, Right : Unsigned_Quadword) return Unsigned_Quadword;
|
213 |
|
|
|
214 |
|
|
function To_Unsigned_Quadword (X : Bit_Array_64) return Unsigned_Quadword;
|
215 |
|
|
function To_Bit_Array_64 (X : Unsigned_Quadword) return Bit_Array_64;
|
216 |
|
|
|
217 |
|
|
type Unsigned_Quadword_Array is
|
218 |
|
|
array (Integer range <>) of Unsigned_Quadword;
|
219 |
|
|
|
220 |
|
|
function To_Address (X : Integer) return Address;
|
221 |
|
|
pragma Pure_Function (To_Address);
|
222 |
|
|
|
223 |
|
|
function To_Address_Long (X : Unsigned_Longword) return Address;
|
224 |
|
|
pragma Pure_Function (To_Address_Long);
|
225 |
|
|
|
226 |
|
|
function To_Integer (X : Address) return Integer;
|
227 |
|
|
|
228 |
|
|
function To_Unsigned_Longword (X : Address) return Unsigned_Longword;
|
229 |
|
|
function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword;
|
230 |
|
|
|
231 |
|
|
-- Conventional names for static subtypes of type UNSIGNED_LONGWORD
|
232 |
|
|
|
233 |
|
|
subtype Unsigned_1 is Unsigned_Longword range 0 .. 2** 1-1;
|
234 |
|
|
subtype Unsigned_2 is Unsigned_Longword range 0 .. 2** 2-1;
|
235 |
|
|
subtype Unsigned_3 is Unsigned_Longword range 0 .. 2** 3-1;
|
236 |
|
|
subtype Unsigned_4 is Unsigned_Longword range 0 .. 2** 4-1;
|
237 |
|
|
subtype Unsigned_5 is Unsigned_Longword range 0 .. 2** 5-1;
|
238 |
|
|
subtype Unsigned_6 is Unsigned_Longword range 0 .. 2** 6-1;
|
239 |
|
|
subtype Unsigned_7 is Unsigned_Longword range 0 .. 2** 7-1;
|
240 |
|
|
subtype Unsigned_8 is Unsigned_Longword range 0 .. 2** 8-1;
|
241 |
|
|
subtype Unsigned_9 is Unsigned_Longword range 0 .. 2** 9-1;
|
242 |
|
|
subtype Unsigned_10 is Unsigned_Longword range 0 .. 2**10-1;
|
243 |
|
|
subtype Unsigned_11 is Unsigned_Longword range 0 .. 2**11-1;
|
244 |
|
|
subtype Unsigned_12 is Unsigned_Longword range 0 .. 2**12-1;
|
245 |
|
|
subtype Unsigned_13 is Unsigned_Longword range 0 .. 2**13-1;
|
246 |
|
|
subtype Unsigned_14 is Unsigned_Longword range 0 .. 2**14-1;
|
247 |
|
|
subtype Unsigned_15 is Unsigned_Longword range 0 .. 2**15-1;
|
248 |
|
|
subtype Unsigned_16 is Unsigned_Longword range 0 .. 2**16-1;
|
249 |
|
|
subtype Unsigned_17 is Unsigned_Longword range 0 .. 2**17-1;
|
250 |
|
|
subtype Unsigned_18 is Unsigned_Longword range 0 .. 2**18-1;
|
251 |
|
|
subtype Unsigned_19 is Unsigned_Longword range 0 .. 2**19-1;
|
252 |
|
|
subtype Unsigned_20 is Unsigned_Longword range 0 .. 2**20-1;
|
253 |
|
|
subtype Unsigned_21 is Unsigned_Longword range 0 .. 2**21-1;
|
254 |
|
|
subtype Unsigned_22 is Unsigned_Longword range 0 .. 2**22-1;
|
255 |
|
|
subtype Unsigned_23 is Unsigned_Longword range 0 .. 2**23-1;
|
256 |
|
|
subtype Unsigned_24 is Unsigned_Longword range 0 .. 2**24-1;
|
257 |
|
|
subtype Unsigned_25 is Unsigned_Longword range 0 .. 2**25-1;
|
258 |
|
|
subtype Unsigned_26 is Unsigned_Longword range 0 .. 2**26-1;
|
259 |
|
|
subtype Unsigned_27 is Unsigned_Longword range 0 .. 2**27-1;
|
260 |
|
|
subtype Unsigned_28 is Unsigned_Longword range 0 .. 2**28-1;
|
261 |
|
|
subtype Unsigned_29 is Unsigned_Longword range 0 .. 2**29-1;
|
262 |
|
|
subtype Unsigned_30 is Unsigned_Longword range 0 .. 2**30-1;
|
263 |
|
|
subtype Unsigned_31 is Unsigned_Longword range 0 .. 2**31-1;
|
264 |
|
|
|
265 |
|
|
-- Function for obtaining global symbol values
|
266 |
|
|
|
267 |
|
|
function Import_Value (Symbol : String) return Unsigned_Longword;
|
268 |
|
|
function Import_Address (Symbol : String) return Address;
|
269 |
|
|
function Import_Largest_Value (Symbol : String) return Largest_Integer;
|
270 |
|
|
|
271 |
|
|
pragma Import (Intrinsic, Import_Value);
|
272 |
|
|
pragma Import (Intrinsic, Import_Address);
|
273 |
|
|
pragma Import (Intrinsic, Import_Largest_Value);
|
274 |
|
|
|
275 |
|
|
-- For the following declarations, note that the declaration without
|
276 |
|
|
-- a Retry_Count parameter means to retry infinitely. A value of zero
|
277 |
|
|
-- for the Retry_Count parameter means do not retry.
|
278 |
|
|
|
279 |
|
|
-- Interlocked-instruction procedures
|
280 |
|
|
|
281 |
|
|
procedure Clear_Interlocked
|
282 |
|
|
(Bit : in out Boolean;
|
283 |
|
|
Old_Value : out Boolean);
|
284 |
|
|
|
285 |
|
|
procedure Set_Interlocked
|
286 |
|
|
(Bit : in out Boolean;
|
287 |
|
|
Old_Value : out Boolean);
|
288 |
|
|
|
289 |
|
|
type Aligned_Word is record
|
290 |
|
|
Value : Short_Integer;
|
291 |
|
|
end record;
|
292 |
|
|
|
293 |
|
|
for Aligned_Word'Alignment use
|
294 |
|
|
Integer'Min (2, Standard'Maximum_Alignment);
|
295 |
|
|
|
296 |
|
|
procedure Clear_Interlocked
|
297 |
|
|
(Bit : in out Boolean;
|
298 |
|
|
Old_Value : out Boolean;
|
299 |
|
|
Retry_Count : Natural;
|
300 |
|
|
Success_Flag : out Boolean);
|
301 |
|
|
|
302 |
|
|
procedure Set_Interlocked
|
303 |
|
|
(Bit : in out Boolean;
|
304 |
|
|
Old_Value : out Boolean;
|
305 |
|
|
Retry_Count : Natural;
|
306 |
|
|
Success_Flag : out Boolean);
|
307 |
|
|
|
308 |
|
|
procedure Add_Interlocked
|
309 |
|
|
(Addend : Short_Integer;
|
310 |
|
|
Augend : in out Aligned_Word;
|
311 |
|
|
Sign : out Integer);
|
312 |
|
|
|
313 |
|
|
type Aligned_Integer is record
|
314 |
|
|
Value : Integer;
|
315 |
|
|
end record;
|
316 |
|
|
|
317 |
|
|
for Aligned_Integer'Alignment use
|
318 |
|
|
Integer'Min (4, Standard'Maximum_Alignment);
|
319 |
|
|
|
320 |
|
|
type Aligned_Long_Integer is record
|
321 |
|
|
Value : Long_Integer;
|
322 |
|
|
end record;
|
323 |
|
|
|
324 |
|
|
for Aligned_Long_Integer'Alignment use
|
325 |
|
|
Integer'Min (8, Standard'Maximum_Alignment);
|
326 |
|
|
|
327 |
|
|
-- For the following declarations, note that the declaration without
|
328 |
|
|
-- a Retry_Count parameter mean to retry infinitely. A value of zero
|
329 |
|
|
-- for the Retry_Count means do not retry.
|
330 |
|
|
|
331 |
|
|
procedure Add_Atomic
|
332 |
|
|
(To : in out Aligned_Integer;
|
333 |
|
|
Amount : Integer);
|
334 |
|
|
|
335 |
|
|
procedure Add_Atomic
|
336 |
|
|
(To : in out Aligned_Integer;
|
337 |
|
|
Amount : Integer;
|
338 |
|
|
Retry_Count : Natural;
|
339 |
|
|
Old_Value : out Integer;
|
340 |
|
|
Success_Flag : out Boolean);
|
341 |
|
|
|
342 |
|
|
procedure Add_Atomic
|
343 |
|
|
(To : in out Aligned_Long_Integer;
|
344 |
|
|
Amount : Long_Integer);
|
345 |
|
|
|
346 |
|
|
procedure Add_Atomic
|
347 |
|
|
(To : in out Aligned_Long_Integer;
|
348 |
|
|
Amount : Long_Integer;
|
349 |
|
|
Retry_Count : Natural;
|
350 |
|
|
Old_Value : out Long_Integer;
|
351 |
|
|
Success_Flag : out Boolean);
|
352 |
|
|
|
353 |
|
|
procedure And_Atomic
|
354 |
|
|
(To : in out Aligned_Integer;
|
355 |
|
|
From : Integer);
|
356 |
|
|
|
357 |
|
|
procedure And_Atomic
|
358 |
|
|
(To : in out Aligned_Integer;
|
359 |
|
|
From : Integer;
|
360 |
|
|
Retry_Count : Natural;
|
361 |
|
|
Old_Value : out Integer;
|
362 |
|
|
Success_Flag : out Boolean);
|
363 |
|
|
|
364 |
|
|
procedure And_Atomic
|
365 |
|
|
(To : in out Aligned_Long_Integer;
|
366 |
|
|
From : Long_Integer);
|
367 |
|
|
|
368 |
|
|
procedure And_Atomic
|
369 |
|
|
(To : in out Aligned_Long_Integer;
|
370 |
|
|
From : Long_Integer;
|
371 |
|
|
Retry_Count : Natural;
|
372 |
|
|
Old_Value : out Long_Integer;
|
373 |
|
|
Success_Flag : out Boolean);
|
374 |
|
|
|
375 |
|
|
procedure Or_Atomic
|
376 |
|
|
(To : in out Aligned_Integer;
|
377 |
|
|
From : Integer);
|
378 |
|
|
|
379 |
|
|
procedure Or_Atomic
|
380 |
|
|
(To : in out Aligned_Integer;
|
381 |
|
|
From : Integer;
|
382 |
|
|
Retry_Count : Natural;
|
383 |
|
|
Old_Value : out Integer;
|
384 |
|
|
Success_Flag : out Boolean);
|
385 |
|
|
|
386 |
|
|
procedure Or_Atomic
|
387 |
|
|
(To : in out Aligned_Long_Integer;
|
388 |
|
|
From : Long_Integer);
|
389 |
|
|
|
390 |
|
|
procedure Or_Atomic
|
391 |
|
|
(To : in out Aligned_Long_Integer;
|
392 |
|
|
From : Long_Integer;
|
393 |
|
|
Retry_Count : Natural;
|
394 |
|
|
Old_Value : out Long_Integer;
|
395 |
|
|
Success_Flag : out Boolean);
|
396 |
|
|
|
397 |
|
|
type Insq_Status is
|
398 |
|
|
(Fail_No_Lock, OK_Not_First, OK_First);
|
399 |
|
|
|
400 |
|
|
for Insq_Status use
|
401 |
|
|
(Fail_No_Lock => -1,
|
402 |
|
|
OK_Not_First => 0,
|
403 |
|
|
OK_First => +1);
|
404 |
|
|
|
405 |
|
|
type Remq_Status is (
|
406 |
|
|
Fail_No_Lock,
|
407 |
|
|
Fail_Was_Empty,
|
408 |
|
|
OK_Not_Empty,
|
409 |
|
|
OK_Empty);
|
410 |
|
|
|
411 |
|
|
for Remq_Status use
|
412 |
|
|
(Fail_No_Lock => -1,
|
413 |
|
|
Fail_Was_Empty => 0,
|
414 |
|
|
OK_Not_Empty => +1,
|
415 |
|
|
OK_Empty => +2);
|
416 |
|
|
|
417 |
|
|
procedure Insqhi
|
418 |
|
|
(Item : Address;
|
419 |
|
|
Header : Address;
|
420 |
|
|
Status : out Insq_Status);
|
421 |
|
|
|
422 |
|
|
procedure Remqhi
|
423 |
|
|
(Header : Address;
|
424 |
|
|
Item : out Address;
|
425 |
|
|
Status : out Remq_Status);
|
426 |
|
|
|
427 |
|
|
procedure Insqti
|
428 |
|
|
(Item : Address;
|
429 |
|
|
Header : Address;
|
430 |
|
|
Status : out Insq_Status);
|
431 |
|
|
|
432 |
|
|
procedure Remqti
|
433 |
|
|
(Header : Address;
|
434 |
|
|
Item : out Address;
|
435 |
|
|
Status : out Remq_Status);
|
436 |
|
|
|
437 |
|
|
private
|
438 |
|
|
|
439 |
|
|
Address_Zero : constant Address := Null_Address;
|
440 |
|
|
No_Addr : constant Address := Null_Address;
|
441 |
|
|
|
442 |
|
|
-- An AST_Handler value is from a typing point of view simply a pointer
|
443 |
|
|
-- to a procedure taking a single 64bit parameter. However, this
|
444 |
|
|
-- is a bit misleading, because the data that this pointer references is
|
445 |
|
|
-- highly stylized. See body of System.AST_Handling for full details.
|
446 |
|
|
|
447 |
|
|
type AST_Handler is access procedure (Param : Long_Integer);
|
448 |
|
|
No_AST_Handler : constant AST_Handler := null;
|
449 |
|
|
|
450 |
|
|
-- Other operators have incorrect profiles. It would be nice to make
|
451 |
|
|
-- them intrinsic, since the backend can handle them, but the front
|
452 |
|
|
-- end is not prepared to deal with them, so at least inline them.
|
453 |
|
|
|
454 |
|
|
pragma Inline_Always ("+");
|
455 |
|
|
pragma Inline_Always ("-");
|
456 |
|
|
pragma Inline_Always ("not");
|
457 |
|
|
pragma Inline_Always ("and");
|
458 |
|
|
pragma Inline_Always ("or");
|
459 |
|
|
pragma Inline_Always ("xor");
|
460 |
|
|
|
461 |
|
|
-- Other inlined subprograms
|
462 |
|
|
|
463 |
|
|
pragma Inline_Always (Fetch_From_Address);
|
464 |
|
|
pragma Inline_Always (Assign_To_Address);
|
465 |
|
|
|
466 |
|
|
-- Synchronization related subprograms. Mechanism is explicitly set
|
467 |
|
|
-- so that the critical parameters are passed by reference.
|
468 |
|
|
-- Without this, the parameters are passed by copy, creating load/store
|
469 |
|
|
-- race conditions. We also inline them, since this seems more in the
|
470 |
|
|
-- spirit of the original (hardware intrinsic) routines.
|
471 |
|
|
|
472 |
|
|
pragma Export_Procedure
|
473 |
|
|
(Clear_Interlocked,
|
474 |
|
|
External => "system__aux_dec__clear_interlocked__1",
|
475 |
|
|
Parameter_Types => (Boolean, Boolean),
|
476 |
|
|
Mechanism => (Reference, Reference));
|
477 |
|
|
pragma Export_Procedure
|
478 |
|
|
(Clear_Interlocked,
|
479 |
|
|
External => "system__aux_dec__clear_interlocked__2",
|
480 |
|
|
Parameter_Types => (Boolean, Boolean, Natural, Boolean),
|
481 |
|
|
Mechanism => (Reference, Reference, Value, Reference));
|
482 |
|
|
pragma Inline_Always (Clear_Interlocked);
|
483 |
|
|
|
484 |
|
|
pragma Export_Procedure
|
485 |
|
|
(Set_Interlocked,
|
486 |
|
|
External => "system__aux_dec__set_interlocked__1",
|
487 |
|
|
Parameter_Types => (Boolean, Boolean),
|
488 |
|
|
Mechanism => (Reference, Reference));
|
489 |
|
|
pragma Export_Procedure
|
490 |
|
|
(Set_Interlocked,
|
491 |
|
|
External => "system__aux_dec__set_interlocked__2",
|
492 |
|
|
Parameter_Types => (Boolean, Boolean, Natural, Boolean),
|
493 |
|
|
Mechanism => (Reference, Reference, Value, Reference));
|
494 |
|
|
pragma Inline_Always (Set_Interlocked);
|
495 |
|
|
|
496 |
|
|
pragma Export_Procedure
|
497 |
|
|
(Add_Interlocked,
|
498 |
|
|
External => "system__aux_dec__add_interlocked__1",
|
499 |
|
|
Mechanism => (Value, Reference, Reference));
|
500 |
|
|
pragma Inline_Always (Add_Interlocked);
|
501 |
|
|
|
502 |
|
|
pragma Export_Procedure
|
503 |
|
|
(Add_Atomic,
|
504 |
|
|
External => "system__aux_dec__add_atomic__1",
|
505 |
|
|
Parameter_Types => (Aligned_Integer, Integer),
|
506 |
|
|
Mechanism => (Reference, Value));
|
507 |
|
|
pragma Export_Procedure
|
508 |
|
|
(Add_Atomic,
|
509 |
|
|
External => "system__aux_dec__add_atomic__2",
|
510 |
|
|
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
|
511 |
|
|
Mechanism => (Reference, Value, Value, Reference, Reference));
|
512 |
|
|
pragma Export_Procedure
|
513 |
|
|
(Add_Atomic,
|
514 |
|
|
External => "system__aux_dec__add_atomic__3",
|
515 |
|
|
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
|
516 |
|
|
Mechanism => (Reference, Value));
|
517 |
|
|
pragma Export_Procedure
|
518 |
|
|
(Add_Atomic,
|
519 |
|
|
External => "system__aux_dec__add_atomic__4",
|
520 |
|
|
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
|
521 |
|
|
Long_Integer, Boolean),
|
522 |
|
|
Mechanism => (Reference, Value, Value, Reference, Reference));
|
523 |
|
|
pragma Inline_Always (Add_Atomic);
|
524 |
|
|
|
525 |
|
|
pragma Export_Procedure
|
526 |
|
|
(And_Atomic,
|
527 |
|
|
External => "system__aux_dec__and_atomic__1",
|
528 |
|
|
Parameter_Types => (Aligned_Integer, Integer),
|
529 |
|
|
Mechanism => (Reference, Value));
|
530 |
|
|
pragma Export_Procedure
|
531 |
|
|
(And_Atomic,
|
532 |
|
|
External => "system__aux_dec__and_atomic__2",
|
533 |
|
|
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
|
534 |
|
|
Mechanism => (Reference, Value, Value, Reference, Reference));
|
535 |
|
|
pragma Export_Procedure
|
536 |
|
|
(And_Atomic,
|
537 |
|
|
External => "system__aux_dec__and_atomic__3",
|
538 |
|
|
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
|
539 |
|
|
Mechanism => (Reference, Value));
|
540 |
|
|
pragma Export_Procedure
|
541 |
|
|
(And_Atomic,
|
542 |
|
|
External => "system__aux_dec__and_atomic__4",
|
543 |
|
|
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
|
544 |
|
|
Long_Integer, Boolean),
|
545 |
|
|
Mechanism => (Reference, Value, Value, Reference, Reference));
|
546 |
|
|
pragma Inline_Always (And_Atomic);
|
547 |
|
|
|
548 |
|
|
pragma Export_Procedure
|
549 |
|
|
(Or_Atomic,
|
550 |
|
|
External => "system__aux_dec__or_atomic__1",
|
551 |
|
|
Parameter_Types => (Aligned_Integer, Integer),
|
552 |
|
|
Mechanism => (Reference, Value));
|
553 |
|
|
pragma Export_Procedure
|
554 |
|
|
(Or_Atomic,
|
555 |
|
|
External => "system__aux_dec__or_atomic__2",
|
556 |
|
|
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
|
557 |
|
|
Mechanism => (Reference, Value, Value, Reference, Reference));
|
558 |
|
|
pragma Export_Procedure
|
559 |
|
|
(Or_Atomic,
|
560 |
|
|
External => "system__aux_dec__or_atomic__3",
|
561 |
|
|
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
|
562 |
|
|
Mechanism => (Reference, Value));
|
563 |
|
|
pragma Export_Procedure
|
564 |
|
|
(Or_Atomic,
|
565 |
|
|
External => "system__aux_dec__or_atomic__4",
|
566 |
|
|
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
|
567 |
|
|
Long_Integer, Boolean),
|
568 |
|
|
Mechanism => (Reference, Value, Value, Reference, Reference));
|
569 |
|
|
pragma Inline_Always (Or_Atomic);
|
570 |
|
|
|
571 |
|
|
-- Provide proper unchecked conversion definitions for transfer
|
572 |
|
|
-- functions. Note that we need this level of indirection because
|
573 |
|
|
-- the formal parameter name is X and not Source (and this is indeed
|
574 |
|
|
-- detectable by a program)
|
575 |
|
|
|
576 |
|
|
function To_Unsigned_Byte_A is new
|
577 |
|
|
Ada.Unchecked_Conversion (Bit_Array_8, Unsigned_Byte);
|
578 |
|
|
|
579 |
|
|
function To_Unsigned_Byte (X : Bit_Array_8) return Unsigned_Byte
|
580 |
|
|
renames To_Unsigned_Byte_A;
|
581 |
|
|
|
582 |
|
|
function To_Bit_Array_8_A is new
|
583 |
|
|
Ada.Unchecked_Conversion (Unsigned_Byte, Bit_Array_8);
|
584 |
|
|
|
585 |
|
|
function To_Bit_Array_8 (X : Unsigned_Byte) return Bit_Array_8
|
586 |
|
|
renames To_Bit_Array_8_A;
|
587 |
|
|
|
588 |
|
|
function To_Unsigned_Word_A is new
|
589 |
|
|
Ada.Unchecked_Conversion (Bit_Array_16, Unsigned_Word);
|
590 |
|
|
|
591 |
|
|
function To_Unsigned_Word (X : Bit_Array_16) return Unsigned_Word
|
592 |
|
|
renames To_Unsigned_Word_A;
|
593 |
|
|
|
594 |
|
|
function To_Bit_Array_16_A is new
|
595 |
|
|
Ada.Unchecked_Conversion (Unsigned_Word, Bit_Array_16);
|
596 |
|
|
|
597 |
|
|
function To_Bit_Array_16 (X : Unsigned_Word) return Bit_Array_16
|
598 |
|
|
renames To_Bit_Array_16_A;
|
599 |
|
|
|
600 |
|
|
function To_Unsigned_Longword_A is new
|
601 |
|
|
Ada.Unchecked_Conversion (Bit_Array_32, Unsigned_Longword);
|
602 |
|
|
|
603 |
|
|
function To_Unsigned_Longword (X : Bit_Array_32) return Unsigned_Longword
|
604 |
|
|
renames To_Unsigned_Longword_A;
|
605 |
|
|
|
606 |
|
|
function To_Bit_Array_32_A is new
|
607 |
|
|
Ada.Unchecked_Conversion (Unsigned_Longword, Bit_Array_32);
|
608 |
|
|
|
609 |
|
|
function To_Bit_Array_32 (X : Unsigned_Longword) return Bit_Array_32
|
610 |
|
|
renames To_Bit_Array_32_A;
|
611 |
|
|
|
612 |
|
|
function To_Unsigned_32_A is new
|
613 |
|
|
Ada.Unchecked_Conversion (Bit_Array_32, Unsigned_32);
|
614 |
|
|
|
615 |
|
|
function To_Unsigned_32 (X : Bit_Array_32) return Unsigned_32
|
616 |
|
|
renames To_Unsigned_32_A;
|
617 |
|
|
|
618 |
|
|
function To_Bit_Array_32_A is new
|
619 |
|
|
Ada.Unchecked_Conversion (Unsigned_32, Bit_Array_32);
|
620 |
|
|
|
621 |
|
|
function To_Bit_Array_32 (X : Unsigned_32) return Bit_Array_32
|
622 |
|
|
renames To_Bit_Array_32_A;
|
623 |
|
|
|
624 |
|
|
function To_Unsigned_Quadword_A is new
|
625 |
|
|
Ada.Unchecked_Conversion (Bit_Array_64, Unsigned_Quadword);
|
626 |
|
|
|
627 |
|
|
function To_Unsigned_Quadword (X : Bit_Array_64) return Unsigned_Quadword
|
628 |
|
|
renames To_Unsigned_Quadword_A;
|
629 |
|
|
|
630 |
|
|
function To_Bit_Array_64_A is new
|
631 |
|
|
Ada.Unchecked_Conversion (Unsigned_Quadword, Bit_Array_64);
|
632 |
|
|
|
633 |
|
|
function To_Bit_Array_64 (X : Unsigned_Quadword) return Bit_Array_64
|
634 |
|
|
renames To_Bit_Array_64_A;
|
635 |
|
|
|
636 |
|
|
pragma Warnings (Off);
|
637 |
|
|
-- Turn warnings off. This is needed for systems with 64-bit integers,
|
638 |
|
|
-- where some of these operations are of dubious meaning, but we do not
|
639 |
|
|
-- want warnings when we compile on such systems.
|
640 |
|
|
|
641 |
|
|
function To_Address_A is new
|
642 |
|
|
Ada.Unchecked_Conversion (Integer, Address);
|
643 |
|
|
pragma Pure_Function (To_Address_A);
|
644 |
|
|
|
645 |
|
|
function To_Address (X : Integer) return Address
|
646 |
|
|
renames To_Address_A;
|
647 |
|
|
pragma Pure_Function (To_Address);
|
648 |
|
|
|
649 |
|
|
function To_Address_Long_A is new
|
650 |
|
|
Ada.Unchecked_Conversion (Unsigned_Longword, Address);
|
651 |
|
|
pragma Pure_Function (To_Address_Long_A);
|
652 |
|
|
|
653 |
|
|
function To_Address_Long (X : Unsigned_Longword) return Address
|
654 |
|
|
renames To_Address_Long_A;
|
655 |
|
|
pragma Pure_Function (To_Address_Long);
|
656 |
|
|
|
657 |
|
|
function To_Integer_A is new
|
658 |
|
|
Ada.Unchecked_Conversion (Address, Integer);
|
659 |
|
|
|
660 |
|
|
function To_Integer (X : Address) return Integer
|
661 |
|
|
renames To_Integer_A;
|
662 |
|
|
|
663 |
|
|
function To_Unsigned_Longword_A is new
|
664 |
|
|
Ada.Unchecked_Conversion (Address, Unsigned_Longword);
|
665 |
|
|
|
666 |
|
|
function To_Unsigned_Longword (X : Address) return Unsigned_Longword
|
667 |
|
|
renames To_Unsigned_Longword_A;
|
668 |
|
|
|
669 |
|
|
function To_Unsigned_Longword_A is new
|
670 |
|
|
Ada.Unchecked_Conversion (AST_Handler, Unsigned_Longword);
|
671 |
|
|
|
672 |
|
|
function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword
|
673 |
|
|
renames To_Unsigned_Longword_A;
|
674 |
|
|
|
675 |
|
|
pragma Warnings (On);
|
676 |
|
|
|
677 |
|
|
end System.Aux_DEC;
|