1 2 3#include <asm.inc> 4 5.code 6.align 4 7 8EXTERN _cxx_frame_handler:PROC 9 10MACRO(DEFINE_THISCALL_ALIAS, cxxname, target) 11#ifdef _USE_ML 12 EXTERN ___thiscall&target:PROC 13 ALIAS <&cxxname> = <___thiscall&target> 14#else 15 PUBLIC cxxname 16 .weakref &cxxname, &target 17#endif 18ENDM 19 20DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABQBD@Z, _exception_ctor 21DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABQBDH@Z, _exception_ctor_noalloc 22DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABV0@@Z, _exception_copy_ctor 23DEFINE_THISCALL_ALIAS ??0exception@@QAE@XZ, _exception_default_ctor 24DEFINE_THISCALL_ALIAS ??1exception@@UAE@XZ, _exception_dtor 25DEFINE_THISCALL_ALIAS ??4exception@@QAEAAV0@ABV0@@Z, _exception_opequals 26DEFINE_THISCALL_ALIAS ??_Eexception@@UAEPAXI@Z, _exception_vector_dtor 27DEFINE_THISCALL_ALIAS ??_Gexception@@UAEPAXI@Z, _exception_scalar_dtor 28DEFINE_THISCALL_ALIAS ?what@exception@@UBEPBDXZ, _exception_what 29DEFINE_THISCALL_ALIAS ??0bad_typeid@@QAE@ABV0@@Z, _bad_typeid_copy_ctor 30DEFINE_THISCALL_ALIAS ??0bad_typeid@@QAE@PBD@Z, _bad_typeid_ctor 31DEFINE_THISCALL_ALIAS ??_Fbad_typeid@@QAEXXZ, _bad_typeid_default_ctor 32DEFINE_THISCALL_ALIAS ??1bad_typeid@@UAE@XZ, _bad_typeid_dtor 33DEFINE_THISCALL_ALIAS ??4bad_typeid@@QAEAAV0@ABV0@@Z, _bad_typeid_opequals 34DEFINE_THISCALL_ALIAS ??_Ebad_typeid@@UAEPAXI@Z, _bad_typeid_vector_dtor 35DEFINE_THISCALL_ALIAS ??_Gbad_typeid@@UAEPAXI@Z, _bad_typeid_scalar_dtor 36DEFINE_THISCALL_ALIAS ??0__non_rtti_object@@QAE@ABV0@@Z, ___non_rtti_object_copy_ctor 37DEFINE_THISCALL_ALIAS ??0__non_rtti_object@@QAE@PBD@Z, ___non_rtti_object_ctor 38DEFINE_THISCALL_ALIAS ??1__non_rtti_object@@UAE@XZ, ___non_rtti_object_dtor 39DEFINE_THISCALL_ALIAS ??4__non_rtti_object@@QAEAAV0@ABV0@@Z, ___non_rtti_object_opequals 40DEFINE_THISCALL_ALIAS ??_E__non_rtti_object@@UAEPAXI@Z, ___non_rtti_object_vector_dtor 41DEFINE_THISCALL_ALIAS ??_G__non_rtti_object@@UAEPAXI@Z, ___non_rtti_object_scalar_dtor 42DEFINE_THISCALL_ALIAS ??0bad_cast@@AAE@PBQBD@Z, _bad_cast_ctor 43DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@ABQBD@Z, _bad_cast_ctor 44DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@ABV0@@Z, _bad_cast_copy_ctor 45DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@PBD@Z, _bad_cast_ctor_charptr 46DEFINE_THISCALL_ALIAS ??_Fbad_cast@@QAEXXZ, _bad_cast_default_ctor 47DEFINE_THISCALL_ALIAS ??1bad_cast@@UAE@XZ, _bad_cast_dtor 48DEFINE_THISCALL_ALIAS ??4bad_cast@@QAEAAV0@ABV0@@Z, _bad_cast_opequals 49DEFINE_THISCALL_ALIAS ??_Ebad_cast@@UAEPAXI@Z, _bad_cast_vector_dtor 50DEFINE_THISCALL_ALIAS ??_Gbad_cast@@UAEPAXI@Z, _bad_cast_scalar_dtor 51DEFINE_THISCALL_ALIAS ??8type_info@@QBEHABV0@@Z, _type_info_opequals_equals 52DEFINE_THISCALL_ALIAS ??9type_info@@QBEHABV0@@Z, _type_info_opnot_equals 53DEFINE_THISCALL_ALIAS ?before@type_info@@QBEHABV1@@Z, _type_info_before 54DEFINE_THISCALL_ALIAS ??1type_info@@UAE@XZ, _type_info_dtor 55DEFINE_THISCALL_ALIAS ?name@type_info@@QBEPBDXZ, _type_info_name 56DEFINE_THISCALL_ALIAS ?raw_name@type_info@@QBEPBDXZ, _type_info_raw_name 57 58 59#undef _MSVCRT_ 60MACRO(START_VTABLE, shortname, cxxname) 61EXTERN _&shortname&_rtti:PROC 62EXTERN ___thiscall_&shortname&_vector_dtor:PROC 63 .long _&shortname&_rtti 64PUBLIC _&shortname&_vtable 65_&shortname&_vtable: 66PUBLIC &cxxname 67&cxxname: 68 .long ___thiscall_&shortname&_vector_dtor 69ENDM 70 71MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname) 72 START_VTABLE shortname, cxxname 73 EXTERN ___thiscall_exception_what:PROC 74 .long ___thiscall_exception_what 75ENDM 76 77START_VTABLE type_info, __dummyname_type_info 78DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@ 79DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@ 80DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@ 81DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@ 82 83EXTERN _operator_delete:PROC 84PUBLIC ??3@YAXPAX@Z 85??3@YAXPAX@Z: 86 jmp _operator_delete 87 88EXTERN _operator_new:PROC 89PUBLIC ??_U@YAPAXI@Z 90??_U@YAPAXI@Z: 91 jmp _operator_new 92 93 94MACRO(DEFINE_ALIAS, alias, orig, type) 95EXTERN &orig:&type 96ALIAS <&alias> = <&orig> 97ENDM 98 99DEFINE_ALIAS ??_V@YAXPAX@Z, _operator_delete, PROC 100DEFINE_ALIAS ??2@YAPAXI@Z, _operator_new, PROC 101DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, __query_new_handler, PROC 102DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, __set_new_handler, PROC 103DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, _set_new_handler, PROC 104DEFINE_ALIAS ?_query_new_mode@@YAHXZ, __query_new_mode, PROC 105DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, __set_new_mode, PROC 106DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, __set_se_translator, PROC 107DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, _set_terminate, PROC 108DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, _set_unexpected, PROC 109DEFINE_ALIAS ?terminate@@YAXXZ, _terminate, PROC 110DEFINE_ALIAS ?unexpected@@YAXXZ, _unexpected, PROC 111 112 113// void call_copy_ctor( void *func, void *this, void *src, int has_vbase ); 114PUBLIC _call_copy_ctor 115_call_copy_ctor: 116 push ebp 117 CFI_ADJUST_CFA_OFFSET 4 118 CFI_REL_OFFSET ebp, 0 119 mov ebp, esp 120 CFI_DEF_CFA_REGISTER ebp 121 push 1 122 mov ecx, [ebp + 12] 123 push dword ptr [ebp + 16] 124 call dword ptr [ebp + 8] 125 leave 126 CFI_DEF_CFA esp, 4 127 CFI_SAME_VALUE ebp 128 ret 129 130// void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr ); 131PUBLIC _continue_after_catch 132_continue_after_catch: 133 mov edx, [esp + 4] 134 mov eax, [esp + 8] 135 mov esp, [edx - 4] 136 lea ebp, [edx + 12] 137 jmp eax 138 139// void DECLSPEC_NORETURN call_finally_block( void *code_block, void *base_ptr ); 140PUBLIC _call_finally_block 141_call_finally_block: 142 mov ebp, [esp +8] 143 jmp dword ptr [esp + 4] 144 145// int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void *ebp ); 146PUBLIC _call_filter 147_call_filter: 148 push ebp 149 push [esp + 12] 150 mov ebp, [esp + 20] 151 call dword ptr [esp + 12] 152 pop ebp 153 pop ebp 154 ret 155 156// void *call_handler( void * (*func)(void), void *ebp ); 157PUBLIC _call_handler 158_call_handler: 159 push ebp 160 push ebx 161 push esi 162 push edi 163 mov ebp, [esp + 24] 164 call dword ptr [esp + 20] 165 pop edi 166 pop esi 167 pop ebx 168 pop ebp 169 ret 170 171 172PUBLIC ___CxxFrameHandler 173___CxxFrameHandler: 174 push 0 175 push 0 176 push eax 177 push[esp + 28] 178 push[esp + 28] 179 push[esp + 28] 180 push[esp + 28] 181 call _cxx_frame_handler 182 add esp, 28 183 ret 184 185END 186 187