2015-11-18 Doug Rupp <rupp@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Nov 2015 10:39:37 +0000 (10:39 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Nov 2015 10:39:37 +0000 (10:39 +0000)
* s-parame-vxworks.adb: Reduce default stack size for stack
limit check to a reasonable value
* s-tpopsp-vxworks.adb: Make Stack_Limit a task variable for vx5 and
vxmils.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230534 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/s-parame-vxworks.adb
gcc/ada/s-tpopsp-vxworks.adb

index 275d157..4f3dde0 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-18  Doug Rupp  <rupp@adacore.com>
+
+       * s-parame-vxworks.adb: Reduce default stack size for stack
+       limit check to a reasonable value
+       * s-tpopsp-vxworks.adb: Make Stack_Limit a task variable for vx5 and
+       vxmils.
+
 2015-11-18  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_ch5.adb (Analyze_Assignment): Diagnose assignment where
index d023c8c..c27b092 100644 (file)
@@ -58,7 +58,7 @@ package body System.Parameters is
    begin
       if Default_Stack_Size = -1 then
          if Stack_Check_Limits then
-            return 60 * 1024;
+            return 32 * 1024;
             --  Extra stack to allow for 12K exception area.
          else
             return 20 * 1024;
index fb75510..c3a23c2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---         Copyright (C) 1992-2011, Free Software Foundation, Inc.          --
+--         Copyright (C) 1992-2015, Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNARL 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- --
@@ -44,6 +44,18 @@ package body Specific is
    --  implementation. This mechanism is used to minimize impact on other
    --  targets.
 
+   Stack_Limit : aliased System.Address;
+
+   pragma Import (C, Stack_Limit, "__gnat_stack_limit");
+
+   type Set_Stack_Limit_Proc_Acc is access procedure;
+   pragma Convention (C, Set_Stack_Limit_Proc_Acc);
+
+   Set_Stack_Limit_Hook : Set_Stack_Limit_Proc_Acc;
+   pragma Import (C, Set_Stack_Limit_Hook, "__gnat_set_stack_limit_hook");
+   --  Procedure to be called when a task is created to set stack limit if
+   --  limit checking is used.
+
    ----------------
    -- Initialize --
    ----------------
@@ -80,12 +92,29 @@ package body Specific is
          return;
       end if;
 
-      if taskVarGet (0, ATCB_Key'Access) = ERROR then
-         Result := taskVarAdd (0, ATCB_Key'Access);
+      if not Is_Valid_Task then
+         Result := taskVarAdd (Self_Id.Common.LL.Thread, ATCB_Key'Access);
          pragma Assert (Result = OK);
+
+         if Stack_Check_Limits
+           and then Result /= ERROR
+           and then Set_Stack_Limit_Hook /= null
+         then
+            --  This will be initialized from taskInfoGet() once the task is
+            --  is running.
+
+            Result :=
+              taskVarAdd (Self_Id.Common.LL.Thread, Stack_Limit'Access);
+            pragma Assert (Result /= ERROR);
+         end if;
       end if;
 
-      ATCB_Key := To_Address (Self_Id);
+      Result :=
+        taskVarSet
+          (Self_Id.Common.LL.Thread,
+           ATCB_Key'Access,
+           To_Address (Self_Id));
+      pragma Assert (Result /= ERROR);
    end Set;
 
    ----------