OSDN Git Service

* config/vax/vax.h (target_flags, MASK_UNIX_ASM, MASK_VAXC_ALIGNMENT)
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tarest.adb
index 3d4a0fd..93126f0 100644 (file)
@@ -67,6 +67,9 @@ with System.Soft_Links;
 --  The GNARL must call these to be sure that all non-tasking
 --  Ada constructs will work.
 
+with System.Soft_Links.Tasking;
+--  Used for Init_Tasking_Soft_Links
+
 with System.Secondary_Stack;
 --  used for SS_Init;
 
@@ -105,21 +108,6 @@ package body System.Tasking.Restricted.Stages is
    --  all nested locks must be released before other tasks competing for the
    --  tasking lock are released.
 
-   --  See s-tasini.adb for more information on the following functions.
-
-   function Get_Jmpbuf_Address return Address;
-   procedure Set_Jmpbuf_Address (Addr : Address);
-
-   function Get_Sec_Stack_Addr return Address;
-   procedure Set_Sec_Stack_Addr (Addr : Address);
-
-   function  Get_Machine_State_Addr return Address;
-   procedure Set_Machine_State_Addr (Addr : Address);
-
-   function Get_Current_Excep return SSL.EOA;
-
-   procedure Timed_Delay_T (Time : Duration; Mode : Integer);
-
    -----------------------
    -- Local Subprograms --
    -----------------------
@@ -158,45 +146,6 @@ package body System.Tasking.Restricted.Stages is
       STPO.Unlock (Global_Task_Lock'Access, Global_Lock => True);
    end Task_Unlock;
 
-   ----------------------
-   -- Soft-Link Bodies --
-   ----------------------
-
-   function Get_Current_Excep return SSL.EOA is
-   begin
-      return STPO.Self.Common.Compiler_Data.Current_Excep'Access;
-   end Get_Current_Excep;
-
-   function Get_Jmpbuf_Address return  Address is
-   begin
-      return STPO.Self.Common.Compiler_Data.Jmpbuf_Address;
-   end Get_Jmpbuf_Address;
-
-   function Get_Machine_State_Addr return Address is
-   begin
-      return STPO.Self.Common.Compiler_Data.Machine_State_Addr;
-   end Get_Machine_State_Addr;
-
-   function Get_Sec_Stack_Addr return  Address is
-   begin
-      return STPO.Self.Common.Compiler_Data.Sec_Stack_Addr;
-   end Get_Sec_Stack_Addr;
-
-   procedure Set_Jmpbuf_Address (Addr : Address) is
-   begin
-      STPO.Self.Common.Compiler_Data.Jmpbuf_Address := Addr;
-   end Set_Jmpbuf_Address;
-
-   procedure Set_Machine_State_Addr (Addr : Address) is
-   begin
-      STPO.Self.Common.Compiler_Data.Machine_State_Addr := Addr;
-   end Set_Machine_State_Addr;
-
-   procedure Set_Sec_Stack_Addr (Addr : Address) is
-   begin
-      STPO.Self.Common.Compiler_Data.Sec_Stack_Addr := Addr;
-   end Set_Sec_Stack_Addr;
-
    ------------------
    -- Task_Wrapper --
    ------------------
@@ -262,15 +211,6 @@ package body System.Tasking.Restricted.Stages is
       end;
    end Task_Wrapper;
 
-   -------------------
-   -- Timed_Delay_T --
-   -------------------
-
-   procedure Timed_Delay_T (Time : Duration; Mode : Integer) is
-   begin
-      STPO.Timed_Delay (STPO.Self, Time, Mode);
-   end Timed_Delay_T;
-
    -----------------------
    -- Restricted GNARLI --
    -----------------------
@@ -436,6 +376,7 @@ package body System.Tasking.Restricted.Stages is
 
    procedure Create_Restricted_Task
      (Priority      : Integer;
+      Stack_Address : System.Address;
       Size          : System.Parameters.Size_Type;
       Task_Info     : System.Task_Info.Task_Info_Type;
       State         : Task_Procedure_Access;
@@ -443,22 +384,24 @@ package body System.Tasking.Restricted.Stages is
       Elaborated    : Access_Boolean;
       Chain         : in out Activation_Chain;
       Task_Image    : String;
-      Created_Task  : out Task_Id)
+      Created_Task  : Task_Id)
    is
-      T             : Task_Id;
       Self_ID       : constant Task_Id := STPO.Self;
       Base_Priority : System.Any_Priority;
       Success       : Boolean;
 
    begin
+      --  Stack is not preallocated on this target, so that
+      --  Stack_Address must be null.
+
+      pragma Assert (Stack_Address = Null_Address);
+
       if Priority = Unspecified_Priority then
          Base_Priority := Self_ID.Common.Base_Priority;
       else
          Base_Priority := System.Any_Priority (Priority);
       end if;
 
-      T := New_ATCB (0);
-
       if Single_Lock then
          Lock_RTS;
       end if;
@@ -470,7 +413,7 @@ package body System.Tasking.Restricted.Stages is
 
       Initialize_ATCB
         (Self_ID, State, Discriminants, Self_ID, Elaborated, Base_Priority,
-         Task_Info, Size, T, Success);
+         Task_Info, Size, Created_Task, Success);
 
       --  If we do our job right then there should never be any failures,
       --  which was probably said about the Titanic; so just to be safe,
@@ -486,11 +429,12 @@ package body System.Tasking.Restricted.Stages is
          raise Program_Error;
       end if;
 
-      T.Entry_Calls (1).Self := T;
+      Created_Task.Entry_Calls (1).Self := Created_Task;
 
-      T.Common.Task_Image_Len :=
-        Integer'Min (T.Common.Task_Image'Length, Task_Image'Length);
-      T.Common.Task_Image (1 .. T.Common.Task_Image_Len) := Task_Image;
+      Created_Task.Common.Task_Image_Len :=
+        Integer'Min (Created_Task.Common.Task_Image'Length, Task_Image'Length);
+      Created_Task.Common.Task_Image
+        (1 .. Created_Task.Common.Task_Image_Len) := Task_Image;
 
       Unlock (Self_ID);
 
@@ -501,10 +445,9 @@ package body System.Tasking.Restricted.Stages is
       --  Create TSD as early as possible in the creation of a task, since it
       --  may be used by the operation of Ada code within the task.
 
-      SSL.Create_TSD (T.Common.Compiler_Data);
-      T.Common.Activation_Link := Chain.T_ID;
-      Chain.T_ID   := T;
-      Created_Task := T;
+      SSL.Create_TSD (Created_Task.Common.Compiler_Data);
+      Created_Task.Common.Activation_Link := Chain.T_ID;
+      Chain.T_ID := Created_Task;
    end Create_Restricted_Task;
 
    ---------------------------
@@ -569,27 +512,14 @@ package body System.Tasking.Restricted.Stages is
       --  Notify that the tasking run time has been elaborated so that
       --  the tasking version of the soft links can be used.
 
-      SSL.Lock_Task              := Task_Lock'Access;
-      SSL.Unlock_Task            := Task_Unlock'Access;
-
-      SSL.Get_Jmpbuf_Address     := Get_Jmpbuf_Address'Access;
-      SSL.Set_Jmpbuf_Address     := Set_Jmpbuf_Address'Access;
-      SSL.Get_Machine_State_Addr := Get_Machine_State_Addr'Access;
-      SSL.Set_Machine_State_Addr := Set_Machine_State_Addr'Access;
-      SSL.Get_Current_Excep      := Get_Current_Excep'Access;
-      SSL.Set_Jmpbuf_Address     (SSL.Get_Jmpbuf_Address_NT);
-      SSL.Set_Machine_State_Addr (SSL.Get_Machine_State_Addr_NT);
-
-      SSL.Get_Sec_Stack_Addr     := Get_Sec_Stack_Addr'Access;
-      SSL.Set_Sec_Stack_Addr     := Set_Sec_Stack_Addr'Access;
-
-      --  No need to create a new Secondary Stack, since we will use the
-      --  default one created in s-secsta.adb
+      SSL.Lock_Task   := Task_Lock'Access;
+      SSL.Unlock_Task := Task_Unlock'Access;
+      SSL.Adafinal    := Finalize_Global_Tasks'Access;
 
-      Set_Sec_Stack_Addr (SSL.Get_Sec_Stack_Addr_NT);
+      --  Initialize the tasking soft links (if not done yet) that are common
+      --  to the full and the restricted run times.
 
-      SSL.Timed_Delay            := Timed_Delay_T'Access;
-      SSL.Adafinal               := Finalize_Global_Tasks'Access;
+      SSL.Tasking.Init_Tasking_Soft_Links;
    end Init_RTS;
 
 begin