Usermode/libc++ - Exception handling implemented (partially)
[tpg/acess2.git] / Usermode / Libraries / libc++.so_src / exception_handling_cxxabi.h
1 /*
2  * Acess2 C++ Support Library
3  * - By John Hodge (thePowersGang)
4  *
5  * exception_handling_cxxabi.h
6  * - C++ Exception Handling definitions from the Itanium C++ ABI
7  */
8 #ifndef _EXCEPTION_HANLDING_CXXABI_H_
9 #define _EXCEPTION_HANLDING_CXXABI_H_
10
11 typedef void *(unexpected_handler)(void);
12 typedef void *(terminate_handler)(void);
13
14 struct _Unwind_Context;
15
16 typedef enum {
17         _URC_NO_REASON = 0,
18         _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
19         _URC_FATAL_PHASE2_ERROR = 2,
20         _URC_FATAL_PHASE1_ERROR = 3,
21         _URC_NORMAL_STOP = 4,
22         _URC_END_OF_STACK = 5,
23         _URC_HANDLER_FOUND = 6,
24         _URC_INSTALL_CONTEXT = 7,
25         _URC_CONTINUE_UNWIND = 8
26 } _Unwind_Reason_Code;
27
28 typedef int     _Unwind_Action;
29 static const _Unwind_Action     _UA_SEARCH_PHASE  = 1;
30 static const _Unwind_Action     _UA_CLEANUP_PHASE = 2;
31 static const _Unwind_Action     _UA_HANDLER_FRAME = 4;
32 static const _Unwind_Action     _UA_FORCE_UNWIND  = 8;
33
34 typedef void    (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code reason, struct _Unwind_Exception *exc);
35
36 struct _Unwind_Exception
37 {
38         uint64_t        exception_class;
39         _Unwind_Exception_Cleanup_Fn    exception_cleanup;
40         uint64_t        private_1;
41         uint64_t        private_2;
42 };
43
44 struct __cxa_exception
45 {
46         std::type_info* exceptionType;
47         void (*exceptionDestructor)(void *);
48         unexpected_handler*     unexpectedHandler;
49         terminate_handler*      terminateHandler;
50         __cxa_exception*        nextException;
51         
52         int     handlerCount;
53         
54         int     handlerSwitchValue;
55         const char*     actionRecord;
56         const char*     languageSpecificData;
57         void*   catchTemp;
58         void*   adjustedPtr;
59         
60         _Unwind_Exception       unwindHeader;
61 };
62
63 #define EXCEPTION_CLASS_ACESS   "Ac20C++\0"
64
65 typedef _Unwind_Reason_Code     (*_Unwind_Stop_Fn)(int version, _Unwind_Action actions, uint64_t exception_class, struct _Unwind_Exception *exceptionObject, struct _Unwind_Context *context, void *stop_parameter);
66
67 // Exports
68 extern "C" void __cxa_call_unexpected(void *);
69 extern "C" void *__cxa_allocate_exception(size_t thrown_size);
70 extern "C" void __cxa_free_exception(void *thrown_exception);
71 extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void*));
72 extern "C" void *__cxa_begin_catch(_Unwind_Exception *exceptionObject);
73 extern "C" void __cxa_end_catch();
74
75 // Imports
76 extern "C" _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *exception_object);
77 extern "C" _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *exception_object, _Unwind_Stop_Fn stop, void *stop_parameter);
78 extern "C" void _Unwind_DeleteException(struct _Unwind_Exception *exception_object);
79 extern "C" uint64_t     _Unwind_GetGR(struct _Unwind_Context *context, int index);
80 extern "C" void         _Unwind_SetGR(struct _Unwind_Context *context, int index, uint64_t new_value);
81 extern "C" uint64_t     _Unwind_GetIP(struct _Unwind_Context *context);
82 extern "C" void         _Unwind_SetIP(struct _Unwind_Context *context, uint64_t new_value);
83 extern "C" uint64_t     _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
84 extern "C" uint64_t     _Unwind_GetRegionStart(struct _Unwind_Context *context);
85
86 #endif
87
88

UCC git Repository :: git.ucc.asn.au