OSDN Git Service

PR preprocessor/30805:
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-stache.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4 --                                                                          --
5 --                 S Y S T E M . S T A C K _ C H E C K I N G                --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --           Copyright (C) 1999-2007, Free Software Foundation, Inc.        --
10 --                                                                          --
11 -- GNARL 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 2,  or (at your option) any later ver- --
14 -- sion. GNARL 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.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNARL was developed by the GNARL team at Florida State University.       --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This package provides a system-independent implementation of stack
35 --  checking using comparison with stack base and limit.
36
37 --  This package defines basic types and objects. Operations related to
38 --  stack checking can be found in package System.Stack_Checking.Operations.
39
40 pragma Warnings (Off);
41 pragma Compiler_Unit;
42 pragma Warnings (On);
43
44 with System.Storage_Elements;
45
46 package System.Stack_Checking is
47    pragma Preelaborate;
48    pragma Elaborate_Body;
49    --  This unit has a junk null body. The reason is that historically we
50    --  used to have a real body, and it causes bootstrapping path problems
51    --  to eliminate it, since the old body may still be present in the
52    --  compilation environment for a build.
53
54    type Stack_Info is record
55       Limit : System.Address := System.Null_Address;
56       Base  : System.Address := System.Null_Address;
57       Size  : System.Storage_Elements.Storage_Offset := 0;
58    end record;
59    --  This record may be part of a larger data structure like the
60    --  task control block in the tasking case.
61    --  This specific layout has the advantage of being compatible with the
62    --  Intel x86 BOUNDS instruction.
63
64    type Stack_Access is access all Stack_Info;
65    --  Unique local storage associated with a specific task. This storage is
66    --  used for the stack base and limit, and is returned by Checked_Self.
67    --  Only self may write this information, it may be read by any task.
68    --  At no time the address range Limit .. Base (or Base .. Limit for
69    --  upgrowing stack) may contain any address that is part of another stack.
70    --  The Stack_Access may be part of a larger data structure.
71
72    Multi_Processor : constant Boolean := False; --  Not supported yet
73
74 private
75
76    Null_Stack_Info  : aliased Stack_Info :=
77      (Limit => System.Null_Address,
78       Base  => System.Null_Address,
79       Size  => 0);
80    --  Use explicit assignment to avoid elaboration code (call to init proc)
81
82    Null_Stack : constant Stack_Access := Null_Stack_Info'Access;
83    --  Stack_Access value that will return a Stack_Base and Stack_Limit
84    --  that fail any stack check.
85
86 end System.Stack_Checking;