-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS For A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- These definitions can be used directly by withing this package, or merged
-- with System using pragma Extend_System (Aux_DEC)
-with Unchecked_Conversion;
+with Ada.Unchecked_Conversion;
package System.Aux_DEC is
-pragma Elaborate_Body (Aux_DEC);
+ pragma Preelaborate;
subtype Short_Address is Address;
-- In some versions of System.Aux_DEC, notably that for VMS on the
-- name Short_Address is used for the short address form. To avoid
-- difficulties (in regression tests and elsewhere) with units that
-- reference Short_Address, it is provided for other targets as a
- -- synonum for the normal Address type, and, as in the case where
+ -- synonym for the normal Address type, and, as in the case where
-- the lengths are different, Address and Short_Address can be
-- freely inter-converted.
type Integer_64 is range -2 ** (64 - 1) .. +2 ** (64 - 1) - 1;
for Integer_64'Size use 64;
+ type Integer_8_Array is array (Integer range <>) of Integer_8;
+ type Integer_16_Array is array (Integer range <>) of Integer_16;
+ type Integer_32_Array is array (Integer range <>) of Integer_32;
+ type Integer_64_Array is array (Integer range <>) of Integer_64;
+ -- These array types are not in all versions of DEC System, and in fact it
+ -- is not quite clear why they are in some and not others, but since they
+ -- definitely appear in some versions, we include them unconditionally.
+
type Largest_Integer is range Min_Int .. Max_Int;
- type AST_Handler is limited private;
+ type AST_Handler is private;
No_AST_Handler : constant AST_Handler;
function "or" (Left, Right : Largest_Integer) return Largest_Integer;
function "xor" (Left, Right : Largest_Integer) return Largest_Integer;
- Address_Zero : constant Address;
- No_Addr : constant Address;
- Address_Size : constant := Standard'Address_Size;
+ Address_Zero : constant Address;
+ No_Addr : constant Address;
+ Address_Size : constant := Standard'Address_Size;
+ Short_Address_Size : constant := Standard'Address_Size;
function "+" (Left : Address; Right : Integer) return Address;
function "+" (Left : Integer; Right : Address) return Address;
-- Floating point type declarations for VAX floating point data types
pragma Warnings (Off);
+ -- ??? needs comment
type F_Float is digits 6;
pragma Float_Representation (VAX_Float, F_Float);
type Unsigned_Quadword_Array is
array (Integer range <>) of Unsigned_Quadword;
- function To_Address (X : Integer) return Address;
+ function To_Address (X : Integer) return Address;
pragma Pure_Function (To_Address);
function To_Address_Long (X : Unsigned_Longword) return Address;
pragma Pure_Function (To_Address_Long);
- function To_Integer (X : Address) return Integer;
+ function To_Integer (X : Address) return Integer;
function To_Unsigned_Longword (X : Address) return Unsigned_Longword;
function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword;
procedure Clear_Interlocked
(Bit : in out Boolean;
Old_Value : out Boolean;
- Retry_Count : in Natural;
+ Retry_Count : Natural;
Success_Flag : out Boolean);
procedure Set_Interlocked
(Bit : in out Boolean;
Old_Value : out Boolean;
- Retry_Count : in Natural;
+ Retry_Count : Natural;
Success_Flag : out Boolean);
procedure Add_Interlocked
- (Addend : in Short_Integer;
+ (Addend : Short_Integer;
Augend : in out Aligned_Word;
Sign : out Integer);
procedure Add_Atomic
(To : in out Aligned_Integer;
- Amount : in Integer);
+ Amount : Integer);
procedure Add_Atomic
(To : in out Aligned_Integer;
- Amount : in Integer;
- Retry_Count : in Natural;
+ Amount : Integer;
+ Retry_Count : Natural;
Old_Value : out Integer;
Success_Flag : out Boolean);
procedure Add_Atomic
(To : in out Aligned_Long_Integer;
- Amount : in Long_Integer);
+ Amount : Long_Integer);
procedure Add_Atomic
(To : in out Aligned_Long_Integer;
- Amount : in Long_Integer;
- Retry_Count : in Natural;
+ Amount : Long_Integer;
+ Retry_Count : Natural;
Old_Value : out Long_Integer;
Success_Flag : out Boolean);
procedure And_Atomic
(To : in out Aligned_Integer;
- From : in Integer);
+ From : Integer);
procedure And_Atomic
(To : in out Aligned_Integer;
- From : in Integer;
- Retry_Count : in Natural;
+ From : Integer;
+ Retry_Count : Natural;
Old_Value : out Integer;
Success_Flag : out Boolean);
procedure And_Atomic
(To : in out Aligned_Long_Integer;
- From : in Long_Integer);
+ From : Long_Integer);
procedure And_Atomic
(To : in out Aligned_Long_Integer;
- From : in Long_Integer;
- Retry_Count : in Natural;
+ From : Long_Integer;
+ Retry_Count : Natural;
Old_Value : out Long_Integer;
Success_Flag : out Boolean);
procedure Or_Atomic
(To : in out Aligned_Integer;
- From : in Integer);
+ From : Integer);
procedure Or_Atomic
(To : in out Aligned_Integer;
- From : in Integer;
- Retry_Count : in Natural;
+ From : Integer;
+ Retry_Count : Natural;
Old_Value : out Integer;
Success_Flag : out Boolean);
procedure Or_Atomic
(To : in out Aligned_Long_Integer;
- From : in Long_Integer);
+ From : Long_Integer);
procedure Or_Atomic
(To : in out Aligned_Long_Integer;
- From : in Long_Integer;
- Retry_Count : in Natural;
+ From : Long_Integer;
+ Retry_Count : Natural;
Old_Value : out Long_Integer;
Success_Flag : out Boolean);
OK_Empty => +2);
procedure Insqhi
- (Item : in Address;
- Header : in Address;
+ (Item : Address;
+ Header : Address;
Status : out Insq_Status);
procedure Remqhi
- (Header : in Address;
+ (Header : Address;
Item : out Address;
Status : out Remq_Status);
procedure Insqti
- (Item : in Address;
- Header : in Address;
+ (Item : Address;
+ Header : Address;
Status : out Insq_Status);
procedure Remqti
- (Header : in Address;
+ (Header : Address;
Item : out Address;
Status : out Remq_Status);
pragma Inline_Always (Fetch_From_Address);
pragma Inline_Always (Assign_To_Address);
- -- Synchronization related subprograms. These are declared to have
- -- convention C so that the critical parameters are passed by reference.
+ -- Synchronization related subprograms. Mechanism is explicitly set
+ -- so that the critical parameters are passed by reference.
-- Without this, the parameters are passed by copy, creating load/store
-- race conditions. We also inline them, since this seems more in the
-- spirit of the original (hardware intrinsic) routines.
- pragma Convention (C, Clear_Interlocked);
+ pragma Export_Procedure
+ (Clear_Interlocked,
+ External => "system__aux_dec__clear_interlocked__1",
+ Parameter_Types => (Boolean, Boolean),
+ Mechanism => (Reference, Reference));
+ pragma Export_Procedure
+ (Clear_Interlocked,
+ External => "system__aux_dec__clear_interlocked__2",
+ Parameter_Types => (Boolean, Boolean, Natural, Boolean),
+ Mechanism => (Reference, Reference, Value, Reference));
pragma Inline_Always (Clear_Interlocked);
- pragma Convention (C, Set_Interlocked);
+ pragma Export_Procedure
+ (Set_Interlocked,
+ External => "system__aux_dec__set_interlocked__1",
+ Parameter_Types => (Boolean, Boolean),
+ Mechanism => (Reference, Reference));
+ pragma Export_Procedure
+ (Set_Interlocked,
+ External => "system__aux_dec__set_interlocked__2",
+ Parameter_Types => (Boolean, Boolean, Natural, Boolean),
+ Mechanism => (Reference, Reference, Value, Reference));
pragma Inline_Always (Set_Interlocked);
- pragma Convention (C, Add_Interlocked);
+ pragma Export_Procedure
+ (Add_Interlocked,
+ External => "system__aux_dec__add_interlocked__1",
+ Mechanism => (Value, Reference, Reference));
pragma Inline_Always (Add_Interlocked);
- pragma Convention (C, Add_Atomic);
+ pragma Export_Procedure
+ (Add_Atomic,
+ External => "system__aux_dec__add_atomic__1",
+ Parameter_Types => (Aligned_Integer, Integer),
+ Mechanism => (Reference, Value));
+ pragma Export_Procedure
+ (Add_Atomic,
+ External => "system__aux_dec__add_atomic__2",
+ Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
+ Mechanism => (Reference, Value, Value, Reference, Reference));
+ pragma Export_Procedure
+ (Add_Atomic,
+ External => "system__aux_dec__add_atomic__3",
+ Parameter_Types => (Aligned_Long_Integer, Long_Integer),
+ Mechanism => (Reference, Value));
+ pragma Export_Procedure
+ (Add_Atomic,
+ External => "system__aux_dec__add_atomic__4",
+ Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
+ Long_Integer, Boolean),
+ Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Add_Atomic);
- pragma Convention (C, And_Atomic);
+ pragma Export_Procedure
+ (And_Atomic,
+ External => "system__aux_dec__and_atomic__1",
+ Parameter_Types => (Aligned_Integer, Integer),
+ Mechanism => (Reference, Value));
+ pragma Export_Procedure
+ (And_Atomic,
+ External => "system__aux_dec__and_atomic__2",
+ Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
+ Mechanism => (Reference, Value, Value, Reference, Reference));
+ pragma Export_Procedure
+ (And_Atomic,
+ External => "system__aux_dec__and_atomic__3",
+ Parameter_Types => (Aligned_Long_Integer, Long_Integer),
+ Mechanism => (Reference, Value));
+ pragma Export_Procedure
+ (And_Atomic,
+ External => "system__aux_dec__and_atomic__4",
+ Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
+ Long_Integer, Boolean),
+ Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (And_Atomic);
- pragma Convention (C, Or_Atomic);
+ pragma Export_Procedure
+ (Or_Atomic,
+ External => "system__aux_dec__or_atomic__1",
+ Parameter_Types => (Aligned_Integer, Integer),
+ Mechanism => (Reference, Value));
+ pragma Export_Procedure
+ (Or_Atomic,
+ External => "system__aux_dec__or_atomic__2",
+ Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
+ Mechanism => (Reference, Value, Value, Reference, Reference));
+ pragma Export_Procedure
+ (Or_Atomic,
+ External => "system__aux_dec__or_atomic__3",
+ Parameter_Types => (Aligned_Long_Integer, Long_Integer),
+ Mechanism => (Reference, Value));
+ pragma Export_Procedure
+ (Or_Atomic,
+ External => "system__aux_dec__or_atomic__4",
+ Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
+ Long_Integer, Boolean),
+ Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Or_Atomic);
-- Provide proper unchecked conversion definitions for transfer
-- detectable by a program)
function To_Unsigned_Byte_A is new
- Unchecked_Conversion (Bit_Array_8, Unsigned_Byte);
+ Ada.Unchecked_Conversion (Bit_Array_8, Unsigned_Byte);
function To_Unsigned_Byte (X : Bit_Array_8) return Unsigned_Byte
renames To_Unsigned_Byte_A;
function To_Bit_Array_8_A is new
- Unchecked_Conversion (Unsigned_Byte, Bit_Array_8);
+ Ada.Unchecked_Conversion (Unsigned_Byte, Bit_Array_8);
function To_Bit_Array_8 (X : Unsigned_Byte) return Bit_Array_8
renames To_Bit_Array_8_A;
function To_Unsigned_Word_A is new
- Unchecked_Conversion (Bit_Array_16, Unsigned_Word);
+ Ada.Unchecked_Conversion (Bit_Array_16, Unsigned_Word);
function To_Unsigned_Word (X : Bit_Array_16) return Unsigned_Word
renames To_Unsigned_Word_A;
function To_Bit_Array_16_A is new
- Unchecked_Conversion (Unsigned_Word, Bit_Array_16);
+ Ada.Unchecked_Conversion (Unsigned_Word, Bit_Array_16);
function To_Bit_Array_16 (X : Unsigned_Word) return Bit_Array_16
renames To_Bit_Array_16_A;
function To_Unsigned_Longword_A is new
- Unchecked_Conversion (Bit_Array_32, Unsigned_Longword);
+ Ada.Unchecked_Conversion (Bit_Array_32, Unsigned_Longword);
function To_Unsigned_Longword (X : Bit_Array_32) return Unsigned_Longword
renames To_Unsigned_Longword_A;
function To_Bit_Array_32_A is new
- Unchecked_Conversion (Unsigned_Longword, Bit_Array_32);
+ Ada.Unchecked_Conversion (Unsigned_Longword, Bit_Array_32);
function To_Bit_Array_32 (X : Unsigned_Longword) return Bit_Array_32
renames To_Bit_Array_32_A;
function To_Unsigned_32_A is new
- Unchecked_Conversion (Bit_Array_32, Unsigned_32);
+ Ada.Unchecked_Conversion (Bit_Array_32, Unsigned_32);
function To_Unsigned_32 (X : Bit_Array_32) return Unsigned_32
renames To_Unsigned_32_A;
function To_Bit_Array_32_A is new
- Unchecked_Conversion (Unsigned_32, Bit_Array_32);
+ Ada.Unchecked_Conversion (Unsigned_32, Bit_Array_32);
function To_Bit_Array_32 (X : Unsigned_32) return Bit_Array_32
renames To_Bit_Array_32_A;
function To_Unsigned_Quadword_A is new
- Unchecked_Conversion (Bit_Array_64, Unsigned_Quadword);
+ Ada.Unchecked_Conversion (Bit_Array_64, Unsigned_Quadword);
function To_Unsigned_Quadword (X : Bit_Array_64) return Unsigned_Quadword
renames To_Unsigned_Quadword_A;
function To_Bit_Array_64_A is new
- Unchecked_Conversion (Unsigned_Quadword, Bit_Array_64);
+ Ada.Unchecked_Conversion (Unsigned_Quadword, Bit_Array_64);
function To_Bit_Array_64 (X : Unsigned_Quadword) return Bit_Array_64
renames To_Bit_Array_64_A;
-- want warnings when we compile on such systems.
function To_Address_A is new
- Unchecked_Conversion (Integer, Address);
+ Ada.Unchecked_Conversion (Integer, Address);
pragma Pure_Function (To_Address_A);
function To_Address (X : Integer) return Address
pragma Pure_Function (To_Address);
function To_Address_Long_A is new
- Unchecked_Conversion (Unsigned_Longword, Address);
+ Ada.Unchecked_Conversion (Unsigned_Longword, Address);
pragma Pure_Function (To_Address_Long_A);
function To_Address_Long (X : Unsigned_Longword) return Address
pragma Pure_Function (To_Address_Long);
function To_Integer_A is new
- Unchecked_Conversion (Address, Integer);
+ Ada.Unchecked_Conversion (Address, Integer);
function To_Integer (X : Address) return Integer
renames To_Integer_A;
function To_Unsigned_Longword_A is new
- Unchecked_Conversion (Address, Unsigned_Longword);
+ Ada.Unchecked_Conversion (Address, Unsigned_Longword);
function To_Unsigned_Longword (X : Address) return Unsigned_Longword
renames To_Unsigned_Longword_A;
function To_Unsigned_Longword_A is new
- Unchecked_Conversion (AST_Handler, Unsigned_Longword);
+ Ada.Unchecked_Conversion (AST_Handler, Unsigned_Longword);
function To_Unsigned_Longword (X : AST_Handler) return Unsigned_Longword
renames To_Unsigned_Longword_A;