1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- SYSTEM.MACHINE_STATE_OPERATIONS --
8 -- (Version using the GCC stack unwinding mechanism) --
12 -- Copyright (C) 1999-2001 Ada Core Technologies, Inc. --
14 -- GNAT is free software; you can redistribute it and/or modify it under --
15 -- terms of the GNU General Public License as published by the Free Soft- --
16 -- ware Foundation; either version 2, or (at your option) any later ver- --
17 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
18 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
19 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
20 -- for more details. You should have received a copy of the GNU General --
21 -- Public License distributed with GNAT; see file COPYING. If not, write --
22 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
23 -- MA 02111-1307, USA. --
25 -- As a special exception, if other files instantiate generics from this --
26 -- unit, or you link this unit with other files to produce an executable, --
27 -- this unit does not by itself cause the resulting executable to be --
28 -- covered by the GNU General Public License. This exception does not --
29 -- however invalidate any other reasons why the executable file might be --
30 -- covered by the GNU Public License. --
32 -- GNAT was originally developed by the GNAT team at New York University. --
33 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
35 ------------------------------------------------------------------------------
37 -- This version of System.Machine_State_Operations is for use on
38 -- systems where the GCC stack unwinding mechanism is supported.
39 -- It is currently only used on Solaris
41 package body System
.Machine_State_Operations
is
43 use System
.Storage_Elements
;
44 use System
.Exceptions
;
46 ----------------------------
47 -- Allocate_Machine_State --
48 ----------------------------
50 function Allocate_Machine_State
return Machine_State
is
51 function Machine_State_Length
return Storage_Offset
;
52 pragma Import
(C
, Machine_State_Length
, "__gnat_machine_state_length");
54 function Gnat_Malloc
(Size
: Storage_Offset
) return Machine_State
;
55 pragma Import
(C
, Gnat_Malloc
, "__gnat_malloc");
58 return Gnat_Malloc
(Machine_State_Length
);
59 end Allocate_Machine_State
;
65 procedure Enter_Handler
(M
: Machine_State
; Handler
: Handler_Loc
) is
66 procedure c_enter_handler
(m
: Machine_State
; handler
: Handler_Loc
);
67 pragma Import
(C
, c_enter_handler
, "__gnat_enter_handler");
70 c_enter_handler
(M
, Handler
);
77 function Fetch_Code
(Loc
: Code_Loc
) return Code_Loc
is
82 ------------------------
83 -- Free_Machine_State --
84 ------------------------
86 procedure Free_Machine_State
(M
: in out Machine_State
) is
87 procedure Gnat_Free
(M
: in Machine_State
);
88 pragma Import
(C
, Gnat_Free
, "__gnat_free");
92 M
:= Machine_State
(Null_Address
);
93 end Free_Machine_State
;
99 function Get_Code_Loc
(M
: Machine_State
) return Code_Loc
is
100 function c_get_code_loc
(m
: Machine_State
) return Code_Loc
;
101 pragma Import
(C
, c_get_code_loc
, "__gnat_get_code_loc");
104 return c_get_code_loc
(M
);
107 --------------------------
108 -- Machine_State_Length --
109 --------------------------
111 function Machine_State_Length
return Storage_Offset
is
113 function c_machine_state_length
return Storage_Offset
;
114 pragma Import
(C
, c_machine_state_length
, "__gnat_machine_state_length");
117 return c_machine_state_length
;
118 end Machine_State_Length
;
126 Info
: Subprogram_Info_Type
)
128 procedure c_pop_frame
(m
: Machine_State
);
129 pragma Import
(C
, c_pop_frame
, "__gnat_pop_frame");
135 -----------------------
136 -- Set_Machine_State --
137 -----------------------
139 procedure Set_Machine_State
(M
: Machine_State
) is
140 procedure c_set_machine_state
(m
: Machine_State
);
141 pragma Import
(C
, c_set_machine_state
, "__gnat_set_machine_state");
144 c_set_machine_state
(M
);
145 Pop_Frame
(M
, System
.Null_Address
);
146 end Set_Machine_State
;
148 ------------------------------
149 -- Set_Signal_Machine_State --
150 ------------------------------
152 procedure Set_Signal_Machine_State
154 Context
: System
.Address
) is
157 end Set_Signal_Machine_State
;
159 end System
.Machine_State_Operations
;