summaryrefslogtreecommitdiff
path: root/gcc/ada/s-stchop.adb
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2007-08-14 10:44:14 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:44:14 +0200
commitfebb581c99239fc2aea70aa3647e941604568f06 (patch)
treeab952ee805e9aed74a88701e2571302c7e3bcd3f /gcc/ada/s-stchop.adb
parenta2264f2d5402eae62020d5e7556fb1a5ebd28729 (diff)
downloadgcc-febb581c99239fc2aea70aa3647e941604568f06.tar.gz
s-taprop-linux.adb (Get_Stack_Attributes): New subprogram.
2007-08-14 Olivier Hainque <hainque@adacore.com> * s-taprop-linux.adb (Get_Stack_Attributes): New subprogram. Fetch the stack size and initial stack pointer value for a given task. (Enter_Task): Get the stack attributes of the task we are entering and let the stack checking engine know about them. * s-stchop.adb, s-stchop.ads (Notify_Stack_Attributes): New subprogram. Let the stack-checking engine know about the initial sp value and stack size associated with the current task. (Set_Stack_Info): If a stack base has been notified for the current task, honor it. Fallback to the previous less accurate method otherwise. * s-stchop-vxworks.adb (Notify_Stack_Attributes): Dummy body. From-SVN: r127435
Diffstat (limited to 'gcc/ada/s-stchop.adb')
-rw-r--r--gcc/ada/s-stchop.adb33
1 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ada/s-stchop.adb b/gcc/ada/s-stchop.adb
index c0577afe7fe..aacdad94708 100644
--- a/gcc/ada/s-stchop.adb
+++ b/gcc/ada/s-stchop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2006, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2007, 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- --
@@ -86,6 +86,26 @@ package body System.Stack_Checking.Operations is
Cache := Null_Stack;
end Invalidate_Stack_Cache;
+ -----------------------------
+ -- Notify_Stack_Attributes --
+ -----------------------------
+
+ procedure Notify_Stack_Attributes
+ (Initial_SP : System.Address;
+ Size : System.Storage_Elements.Storage_Offset)
+ is
+ My_Stack : constant Stack_Access := Soft_Links.Get_Stack_Info.all;
+
+ -- We piggyback on the 'Limit' field to store what will be used as the
+ -- 'Base' and leave the 'Size' alone to not interfere with the logic in
+ -- Set_Stack_Info below.
+
+ pragma Unreferenced (Size);
+
+ begin
+ My_Stack.Limit := Initial_SP;
+ end Notify_Stack_Attributes;
+
--------------------
-- Set_Stack_Info --
--------------------
@@ -102,7 +122,7 @@ package body System.Stack_Checking.Operations is
Limit : Integer;
begin
- -- The order of steps 1 .. 3 is important, see specification.
+ -- The order of steps 1 .. 3 is important, see specification
-- 1) Get the Stack_Access value for the current task
@@ -131,7 +151,14 @@ package body System.Stack_Checking.Operations is
end if;
end if;
- My_Stack.Base := Frame_Address;
+ -- If a stack base address has been registered, honor it.
+ -- Fallback to the address of a local object otherwise.
+
+ if My_Stack.Limit /= System.Null_Address then
+ My_Stack.Base := My_Stack.Limit;
+ else
+ My_Stack.Base := Frame_Address;
+ end if;
if Stack_Grows_Down then