1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 // C++ ABI Level 1 ABI documented at:
9 // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html
11 //===----------------------------------------------------------------------===//
13 #ifndef __ITANIUM_UNWIND_H__
14 #define __ITANIUM_UNWIND_H__
16 struct _Unwind_Context
; // opaque
17 struct _Unwind_Exception
; // forward declaration
18 typedef struct _Unwind_Exception _Unwind_Exception
;
19 typedef uint64_t _Unwind_Exception_Class
;
21 struct _Unwind_Exception
{
22 _Unwind_Exception_Class exception_class
;
23 void (*exception_cleanup
)(_Unwind_Reason_Code reason
,
24 _Unwind_Exception
*exc
);
25 #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
26 uintptr_t private_
[6];
28 uintptr_t private_1
; // non-zero means forced unwind
29 uintptr_t private_2
; // holds sp that phase1 found for phase2 to use
31 #if __SIZEOF_POINTER__ == 4
32 // The implementation of _Unwind_Exception uses an attribute mode on the
33 // above fields which has the side effect of causing this whole struct to
34 // round up to 32 bytes in size (48 with SEH). To be more explicit, we add
35 // pad fields added for binary compatibility.
38 // The Itanium ABI requires that _Unwind_Exception objects are "double-word
39 // aligned". GCC has interpreted this to mean "use the maximum useful
40 // alignment for the target"; so do we.
41 } __attribute__((__aligned__
));
43 typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn
)(
44 int version
, _Unwind_Action actions
, uint64_t exceptionClass
,
45 _Unwind_Exception
*exceptionObject
, struct _Unwind_Context
*context
);
52 // The following are the base functions documented by the C++ ABI
54 #ifdef __USING_SJLJ_EXCEPTIONS__
55 extern _Unwind_Reason_Code
56 _Unwind_SjLj_RaiseException(_Unwind_Exception
*exception_object
);
57 extern void _Unwind_SjLj_Resume(_Unwind_Exception
*exception_object
);
59 extern _Unwind_Reason_Code
60 _Unwind_RaiseException(_Unwind_Exception
*exception_object
);
61 extern void _Unwind_Resume(_Unwind_Exception
*exception_object
);
63 extern void _Unwind_DeleteException(_Unwind_Exception
*exception_object
);
66 extern uintptr_t _Unwind_GetGR(struct _Unwind_Context
*context
, int index
);
67 extern void _Unwind_SetGR(struct _Unwind_Context
*context
, int index
,
69 extern uintptr_t _Unwind_GetIP(struct _Unwind_Context
*context
);
70 extern void _Unwind_SetIP(struct _Unwind_Context
*, uintptr_t new_value
);
76 #endif // __ITANIUM_UNWIND_H__