77 lines · c
1//===----------------------------------------------------------------------===//2//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-exception6//7//8// C++ ABI Level 1 ABI documented at:9// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html10//11//===----------------------------------------------------------------------===//12 13#ifndef __ITANIUM_UNWIND_H__14#define __ITANIUM_UNWIND_H__15 16struct _Unwind_Context; // opaque17struct _Unwind_Exception; // forward declaration18typedef struct _Unwind_Exception _Unwind_Exception;19typedef uint64_t _Unwind_Exception_Class;20 21struct _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];27#else28 uintptr_t private_1; // non-zero means forced unwind29 uintptr_t private_2; // holds sp that phase1 found for phase2 to use30#endif31#if __SIZEOF_POINTER__ == 432 // The implementation of _Unwind_Exception uses an attribute mode on the33 // above fields which has the side effect of causing this whole struct to34 // round up to 32 bytes in size (48 with SEH). To be more explicit, we add35 // pad fields added for binary compatibility.36 uint32_t reserved[3];37#endif38 // The Itanium ABI requires that _Unwind_Exception objects are "double-word39 // aligned". GCC has interpreted this to mean "use the maximum useful40 // alignment for the target"; so do we.41} __attribute__((__aligned__));42 43typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(44 int version, _Unwind_Action actions, uint64_t exceptionClass,45 _Unwind_Exception *exceptionObject, struct _Unwind_Context *context);46 47#ifdef __cplusplus48extern "C" {49#endif50 51//52// The following are the base functions documented by the C++ ABI53//54#ifdef __USING_SJLJ_EXCEPTIONS__55extern _Unwind_Reason_Code56 _Unwind_SjLj_RaiseException(_Unwind_Exception *exception_object);57extern void _Unwind_SjLj_Resume(_Unwind_Exception *exception_object);58#else59extern _Unwind_Reason_Code60 _Unwind_RaiseException(_Unwind_Exception *exception_object);61extern void _Unwind_Resume(_Unwind_Exception *exception_object);62#endif63extern void _Unwind_DeleteException(_Unwind_Exception *exception_object);64 65 66extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index);67extern void _Unwind_SetGR(struct _Unwind_Context *context, int index,68 uintptr_t new_value);69extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);70extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);71 72#ifdef __cplusplus73}74#endif75 76#endif // __ITANIUM_UNWIND_H__77