1 2 3#include <asm.inc> 4 5.code 6.align 4 7 8MACRO(DEFINE_THISCALL_ALIAS, cxxname, target) 9#ifdef _USE_ML 10 EXTERN ___thiscall&target:PROC 11 ALIAS <&cxxname> = <___thiscall&target> 12#else 13 PUBLIC cxxname 14 .weakref &cxxname, &target 15#endif 16ENDM 17 18DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABQBD@Z, _MSVCRT_exception_ctor 19DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABQBDH@Z, _MSVCRT_exception_ctor_noalloc 20DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABV0@@Z, _MSVCRT_exception_copy_ctor 21DEFINE_THISCALL_ALIAS ??0exception@@QAE@XZ, _MSVCRT_exception_default_ctor 22DEFINE_THISCALL_ALIAS ??1exception@@UAE@XZ, _MSVCRT_exception_dtor 23DEFINE_THISCALL_ALIAS ??4exception@@QAEAAV0@ABV0@@Z, _MSVCRT_exception_opequals 24DEFINE_THISCALL_ALIAS ??_Eexception@@UAEPAXI@Z, _MSVCRT_exception_vector_dtor 25DEFINE_THISCALL_ALIAS ??_Gexception@@UAEPAXI@Z, _MSVCRT_exception_scalar_dtor 26DEFINE_THISCALL_ALIAS ?what@exception@@UBEPBDXZ, _MSVCRT_what_exception 27DEFINE_THISCALL_ALIAS ??0bad_typeid@@QAE@ABV0@@Z, _MSVCRT_bad_typeid_copy_ctor 28DEFINE_THISCALL_ALIAS ??0bad_typeid@@QAE@PBD@Z, _MSVCRT_bad_typeid_ctor 29DEFINE_THISCALL_ALIAS ??_Fbad_typeid@@QAEXXZ, _MSVCRT_bad_typeid_default_ctor 30DEFINE_THISCALL_ALIAS ??1bad_typeid@@UAE@XZ, _MSVCRT_bad_typeid_dtor 31DEFINE_THISCALL_ALIAS ??4bad_typeid@@QAEAAV0@ABV0@@Z, _MSVCRT_bad_typeid_opequals 32DEFINE_THISCALL_ALIAS ??_Ebad_typeid@@UAEPAXI@Z, _MSVCRT_bad_typeid_vector_dtor 33DEFINE_THISCALL_ALIAS ??_Gbad_typeid@@UAEPAXI@Z, _MSVCRT_bad_typeid_scalar_dtor 34DEFINE_THISCALL_ALIAS ??0__non_rtti_object@@QAE@ABV0@@Z, _MSVCRT___non_rtti_object_copy_ctor 35DEFINE_THISCALL_ALIAS ??0__non_rtti_object@@QAE@PBD@Z, _MSVCRT___non_rtti_object_ctor 36DEFINE_THISCALL_ALIAS ??1__non_rtti_object@@UAE@XZ, _MSVCRT___non_rtti_object_dtor 37DEFINE_THISCALL_ALIAS ??4__non_rtti_object@@QAEAAV0@ABV0@@Z, _MSVCRT___non_rtti_object_opequals 38DEFINE_THISCALL_ALIAS ??_E__non_rtti_object@@UAEPAXI@Z, _MSVCRT___non_rtti_object_vector_dtor 39DEFINE_THISCALL_ALIAS ??_G__non_rtti_object@@UAEPAXI@Z, _MSVCRT___non_rtti_object_scalar_dtor 40DEFINE_THISCALL_ALIAS ??0bad_cast@@AAE@PBQBD@Z, _MSVCRT_bad_cast_ctor 41DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@ABQBD@Z, _MSVCRT_bad_cast_ctor 42DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@ABV0@@Z, _MSVCRT_bad_cast_copy_ctor 43DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@PBD@Z, _MSVCRT_bad_cast_ctor_charptr 44DEFINE_THISCALL_ALIAS ??_Fbad_cast@@QAEXXZ, _MSVCRT_bad_cast_default_ctor 45DEFINE_THISCALL_ALIAS ??1bad_cast@@UAE@XZ, _MSVCRT_bad_cast_dtor 46DEFINE_THISCALL_ALIAS ??4bad_cast@@QAEAAV0@ABV0@@Z, _MSVCRT_bad_cast_opequals 47DEFINE_THISCALL_ALIAS ??_Ebad_cast@@UAEPAXI@Z, _MSVCRT_bad_cast_vector_dtor 48DEFINE_THISCALL_ALIAS ??_Gbad_cast@@UAEPAXI@Z, _MSVCRT_bad_cast_scalar_dtor 49DEFINE_THISCALL_ALIAS ??8type_info@@QBEHABV0@@Z, _MSVCRT_type_info_opequals_equals 50DEFINE_THISCALL_ALIAS ??9type_info@@QBEHABV0@@Z, _MSVCRT_type_info_opnot_equals 51DEFINE_THISCALL_ALIAS ?before@type_info@@QBEHABV1@@Z, _MSVCRT_type_info_before 52DEFINE_THISCALL_ALIAS ??1type_info@@UAE@XZ, _MSVCRT_type_info_dtor 53DEFINE_THISCALL_ALIAS ?name@type_info@@QBEPBDXZ, _MSVCRT_type_info_name 54DEFINE_THISCALL_ALIAS ?raw_name@type_info@@QBEPBDXZ, _MSVCRT_type_info_raw_name 55 56 57#undef _MSVCRT_ 58MACRO(START_VTABLE, shortname, cxxname) 59EXTERN _&shortname&_rtti:PROC 60EXTERN ___thiscall_MSVCRT_&shortname&_vector_dtor:PROC 61 .long _&shortname&_rtti 62PUBLIC _MSVCRT_&shortname&_vtable 63_MSVCRT_&shortname&_vtable: 64PUBLIC &cxxname 65&cxxname: 66 .long ___thiscall_MSVCRT_&shortname&_vector_dtor 67ENDM 68 69MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname) 70 START_VTABLE shortname, cxxname 71 EXTERN ___thiscall_MSVCRT_what_exception:PROC 72 .long ___thiscall_MSVCRT_what_exception 73ENDM 74 75START_VTABLE type_info, __dummyname_type_info 76DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@ 77DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@ 78DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@ 79DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@ 80 81EXTERN _MSVCRT_operator_delete:PROC 82PUBLIC ??3@YAXPAX@Z 83??3@YAXPAX@Z: 84 jmp _MSVCRT_operator_delete 85 86EXTERN _MSVCRT_operator_new:PROC 87PUBLIC ??_U@YAPAXI@Z 88??_U@YAPAXI@Z: 89 jmp _MSVCRT_operator_new 90 91 92MACRO(DEFINE_ALIAS, alias, orig, type) 93EXTERN &orig:&type 94ALIAS <&alias> = <&orig> 95ENDM 96 97DEFINE_ALIAS ??_V@YAXPAX@Z, _MSVCRT_operator_delete, PROC 98DEFINE_ALIAS ??2@YAPAXI@Z, _MSVCRT_operator_new, PROC 99DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, _MSVCRT__query_new_handler, PROC 100DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, _MSVCRT__set_new_handler, PROC 101DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_new_handler, PROC 102DEFINE_ALIAS ?_query_new_mode@@YAHXZ, _MSVCRT__query_new_mode, PROC 103DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, _MSVCRT__set_new_mode, PROC 104DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _MSVCRT__set_se_translator, PROC 105DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_terminate, PROC 106DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_unexpected, PROC 107DEFINE_ALIAS ?terminate@@YAXXZ, _MSVCRT_terminate, PROC 108DEFINE_ALIAS ?unexpected@@YAXXZ, _MSVCRT_unexpected, PROC 109 110 111// void call_copy_ctor( void *func, void *this, void *src, int has_vbase ); 112PUBLIC _call_copy_ctor 113_call_copy_ctor: 114 push ebp 115 CFI_ADJUST_CFA_OFFSET 4 116 CFI_REL_OFFSET ebp, 0 117 mov ebp, esp 118 CFI_DEF_CFA_REGISTER ebp 119 push 1 120 mov ecx, [ebp + 12] 121 push dword ptr [ebp + 16] 122 call dword ptr [ebp + 8] 123 leave 124 CFI_DEF_CFA esp, 4 125 CFI_SAME_VALUE ebp 126 ret 127 128// void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr ); 129PUBLIC _continue_after_catch 130_continue_after_catch: 131 mov edx, [esp + 4] 132 mov eax, [esp + 8] 133 mov esp, [edx - 4] 134 lea ebp, [edx + 12] 135 jmp eax 136 137// void DECLSPEC_NORETURN call_finally_block( void *code_block, void *base_ptr ); 138PUBLIC _call_finally_block 139_call_finally_block: 140 mov ebp, [esp +8] 141 jmp dword ptr [esp + 4] 142 143// int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void *ebp ); 144PUBLIC _call_filter 145_call_filter: 146 push ebp 147 push [esp + 12] 148 mov ebp, [esp + 20] 149 call dword ptr [esp + 12] 150 pop ebp 151 pop ebp 152 ret 153 154// void *call_handler( void * (*func)(void), void *ebp ); 155PUBLIC _call_handler 156_call_handler: 157 push ebp 158 push ebx 159 push esi 160 push edi 161 mov ebp, [esp + 24] 162 call dword ptr [esp + 20] 163 pop edi 164 pop esi 165 pop ebx 166 pop ebp 167 ret 168 169END 170 171