1 module d.rt.unwind;
2 
3 alias _Unwind_Ptr = void*;
4 alias _Unwind_Word = size_t;
5 
6 extern(C):
7 
8 enum _Unwind_Reason_Code {
9 	NO_REASON = 0,
10 	FOREIGN_EXCEPTION_CAUGHT = 1,
11 	FATAL_PHASE2_ERROR = 2,
12 	FATAL_PHASE1_ERROR = 3,
13 	NORMAL_STOP = 4,
14 	END_OF_STACK = 5,
15 	HANDLER_FOUND = 6,
16 	INSTALL_CONTEXT = 7,
17 	CONTINUE_UNWIND = 8,
18 }
19 
20 enum _Unwind_Action {
21 	SEARCH_PHASE = 1,
22 	CLEANUP_PHASE = 2,
23 	HANDLER_FRAME = 4,
24 	FORCE_UNWIND = 8,
25 	END_OF_STACK = 16,
26 }
27 
28 alias _Unwind_Exception_Cleanup_Fn =
29 	void function(_Unwind_Reason_Code, _Unwind_Exception*);
30 
31 // XXX The IA-64 ABI says that this structure must be double-word aligned.
32 // We probably don't follow that.
33 struct _Unwind_Exception {
34 	ulong exception_class;
35 	_Unwind_Exception_Cleanup_Fn exception_cleanup;
36 
37 	_Unwind_Word private_1;
38 	_Unwind_Word private_2;
39 }
40 
41 struct _Unwind_Context {}
42 
43 _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception*);
44 void _Unwind_Resume(_Unwind_Exception*);
45 void _Unwind_DeleteException(_Unwind_Exception*);
46 
47 _Unwind_Ptr _Unwind_GetLanguageSpecificData(_Unwind_Context* ctx);
48 
49 _Unwind_Ptr _Unwind_GetRegionStart(_Unwind_Context* ctx);
50 _Unwind_Ptr _Unwind_GetTextRelBase(_Unwind_Context* ctx);
51 _Unwind_Ptr _Unwind_GetDataRelBase(_Unwind_Context* ctx);
52 
53 _Unwind_Word _Unwind_GetGR(_Unwind_Context* ctx, int i);
54 _Unwind_Ptr _Unwind_GetIP(_Unwind_Context* ctx);
55 
56 void _Unwind_SetGR(_Unwind_Context* ctx, int i, _Unwind_Word n);
57 void _Unwind_SetIP(_Unwind_Context* ctx, _Unwind_Ptr new_value);