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