annotate gcc/ada/libgnat/s-excmac__arm.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . E X C E P T I O N S . M A C H I N E --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 2013-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- Declaration of the machine exception and some associated facilities. The
kono
parents:
diff changeset
33 -- machine exception is the object that is propagated by low level routines
kono
parents:
diff changeset
34 -- and that contains the Ada exception occurrence.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- This is the version using the ARM EHABI mechanism
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 with Ada.Unchecked_Conversion;
kono
parents:
diff changeset
39 with Ada.Exceptions;
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 package System.Exceptions.Machine is
kono
parents:
diff changeset
42 pragma Preelaborate;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 ------------------------------------------------
kono
parents:
diff changeset
45 -- Entities to interface with the GCC runtime --
kono
parents:
diff changeset
46 ------------------------------------------------
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 -- Return codes from GCC runtime functions used to propagate an exception
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 type Unwind_Reason_Code is
kono
parents:
diff changeset
51 (URC_OK,
kono
parents:
diff changeset
52 URC_FOREIGN_EXCEPTION_CAUGHT,
kono
parents:
diff changeset
53 URC_Unused2,
kono
parents:
diff changeset
54 URC_Unused3,
kono
parents:
diff changeset
55 URC_Unused4,
kono
parents:
diff changeset
56 URC_Unused5,
kono
parents:
diff changeset
57 URC_HANDLER_FOUND,
kono
parents:
diff changeset
58 URC_INSTALL_CONTEXT,
kono
parents:
diff changeset
59 URC_CONTINUE_UNWIND,
kono
parents:
diff changeset
60 URC_FAILURE);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 pragma Convention (C, Unwind_Reason_Code);
111
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 pragma Unreferenced
kono
parents:
diff changeset
64 (URC_OK,
kono
parents:
diff changeset
65 URC_FOREIGN_EXCEPTION_CAUGHT,
kono
parents:
diff changeset
66 URC_Unused2,
kono
parents:
diff changeset
67 URC_Unused3,
kono
parents:
diff changeset
68 URC_Unused4,
kono
parents:
diff changeset
69 URC_Unused5,
kono
parents:
diff changeset
70 URC_HANDLER_FOUND,
kono
parents:
diff changeset
71 URC_INSTALL_CONTEXT,
kono
parents:
diff changeset
72 URC_CONTINUE_UNWIND,
kono
parents:
diff changeset
73 URC_FAILURE);
kono
parents:
diff changeset
74
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
75 -- ARM Unwinding State
111
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 type uint32_t is mod 2**32;
kono
parents:
diff changeset
78 pragma Convention (C, uint32_t);
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 type uint32_t_array is array (Natural range <>) of uint32_t;
kono
parents:
diff changeset
81 pragma Convention (C, uint32_t_array);
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 type Unwind_State is new uint32_t;
kono
parents:
diff changeset
84 pragma Convention (C, Unwind_State);
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 US_VIRTUAL_UNWIND_FRAME : constant Unwind_State := 0;
kono
parents:
diff changeset
87 US_UNWIND_FRAME_STARTING : constant Unwind_State := 1;
kono
parents:
diff changeset
88 US_UNWIND_FRAME_RESUME : constant Unwind_State := 2;
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 pragma Unreferenced
kono
parents:
diff changeset
91 (US_VIRTUAL_UNWIND_FRAME,
kono
parents:
diff changeset
92 US_UNWIND_FRAME_STARTING,
kono
parents:
diff changeset
93 US_UNWIND_FRAME_RESUME);
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 -- Mandatory common header for any exception object handled by the
kono
parents:
diff changeset
96 -- GCC unwinding runtime.
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 type Exception_Class is array (0 .. 7) of Character;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 GNAT_Exception_Class : constant Exception_Class := "GNU-Ada" & ASCII.NUL;
kono
parents:
diff changeset
101 -- "GNU-Ada\0"
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 type Unwinder_Cache_Type is record
kono
parents:
diff changeset
104 Reserved1 : uint32_t;
kono
parents:
diff changeset
105 Reserved2 : uint32_t;
kono
parents:
diff changeset
106 Reserved3 : uint32_t;
kono
parents:
diff changeset
107 Reserved4 : uint32_t;
kono
parents:
diff changeset
108 Reserved5 : uint32_t;
kono
parents:
diff changeset
109 end record;
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 type Barrier_Cache_Type is record
kono
parents:
diff changeset
112 Sp : uint32_t;
kono
parents:
diff changeset
113 Bitpattern : uint32_t_array (0 .. 4);
kono
parents:
diff changeset
114 end record;
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 type Cleanup_Cache_Type is record
kono
parents:
diff changeset
117 Bitpattern : uint32_t_array (0 .. 3);
kono
parents:
diff changeset
118 end record;
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 type Pr_Cache_Type is record
kono
parents:
diff changeset
121 Fnstart : uint32_t;
kono
parents:
diff changeset
122 Ehtp : System.Address;
kono
parents:
diff changeset
123 Additional : uint32_t;
kono
parents:
diff changeset
124 Reserved1 : uint32_t;
kono
parents:
diff changeset
125 end record;
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 type Unwind_Control_Block is record
kono
parents:
diff changeset
128 Class : Exception_Class;
kono
parents:
diff changeset
129 Cleanup : System.Address;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 -- Caches
kono
parents:
diff changeset
132 Unwinder_Cache : Unwinder_Cache_Type;
kono
parents:
diff changeset
133 Barrier_Cache : Barrier_Cache_Type;
kono
parents:
diff changeset
134 Cleanup_Cache : Cleanup_Cache_Type;
kono
parents:
diff changeset
135 Pr_Cache : Pr_Cache_Type;
kono
parents:
diff changeset
136 end record;
kono
parents:
diff changeset
137 pragma Convention (C, Unwind_Control_Block);
kono
parents:
diff changeset
138 for Unwind_Control_Block'Alignment use 8;
kono
parents:
diff changeset
139 -- Map the GCC struct used for exception handling
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 type Unwind_Control_Block_Access is access all Unwind_Control_Block;
kono
parents:
diff changeset
142 subtype GCC_Exception_Access is Unwind_Control_Block_Access;
kono
parents:
diff changeset
143 -- Pointer to a UCB
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 procedure Unwind_DeleteException
kono
parents:
diff changeset
146 (Ucbp : not null Unwind_Control_Block_Access);
kono
parents:
diff changeset
147 pragma Import (C, Unwind_DeleteException, "_Unwind_DeleteException");
kono
parents:
diff changeset
148 -- Procedure to free any GCC exception
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 --------------------------------------------------------------
kono
parents:
diff changeset
151 -- GNAT Specific Entities To Deal With The GCC EH Circuitry --
kono
parents:
diff changeset
152 --------------------------------------------------------------
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 -- A GNAT exception object to be dealt with by the personality routine
kono
parents:
diff changeset
155 -- called by the GCC unwinding runtime.
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 type GNAT_GCC_Exception is record
kono
parents:
diff changeset
158 Header : Unwind_Control_Block;
kono
parents:
diff changeset
159 -- ABI Exception header first
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 Occurrence : aliased Ada.Exceptions.Exception_Occurrence;
kono
parents:
diff changeset
162 -- The Ada occurrence
kono
parents:
diff changeset
163 end record;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 pragma Convention (C, GNAT_GCC_Exception);
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 type GNAT_GCC_Exception_Access is access all GNAT_GCC_Exception;
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 function To_GCC_Exception is new
kono
parents:
diff changeset
170 Ada.Unchecked_Conversion (System.Address, GCC_Exception_Access);
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 function To_GNAT_GCC_Exception is new
kono
parents:
diff changeset
173 Ada.Unchecked_Conversion
kono
parents:
diff changeset
174 (GCC_Exception_Access, GNAT_GCC_Exception_Access);
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 function New_Occurrence return GNAT_GCC_Exception_Access;
kono
parents:
diff changeset
177 -- Allocate and initialize a machine occurrence
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 end System.Exceptions.Machine;