[MSVCRT] Add MSVC asm code

This commit is contained in:
Timo Kreuzer
2025-12-30 12:57:14 +02:00
parent f211c68faa
commit 55ca43db3c
8 changed files with 588 additions and 0 deletions
@@ -0,0 +1,115 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x64 C++ V-tables for concurrency.c
* COPYRIGHT: Copyright 2014-2024 Wine team
* Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
// See msvcrt/concurrency.c
.const
MACRO(START_VTABLE, shortname, cxxname)
EXTERN shortname&_rtti:PROC
.quad shortname&_rtti
PUBLIC &shortname&_vtable
&shortname&_vtable:
PUBLIC &cxxname
&cxxname:
ENDM
MACRO(VTABLE_ADD_FUNC_MACRO, name)
EXTERN &name:PROC
.quad &name
ENDM
#define VTABLE_ADD_FUNC(x) VTABLE_ADD_FUNC_MACRO x
START_VTABLE cexception, __dummyname_cexception
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE improper_lock, __dummyname_improper_lock
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE improper_scheduler_attach, __dummyname_improper_scheduler_attach
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE improper_scheduler_detach, __dummyname_improper_scheduler_detach
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE invalid_multiple_scheduling, __dummyname_invalid_multiple_scheduling
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE invalid_scheduler_policy_key, __dummyname_invalid_scheduler_policy_key
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE invalid_scheduler_policy_thread_specification, __dummyname_invalid_scheduler_policy_thread_specification
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE invalid_scheduler_policy_value, __dummyname_invalid_scheduler_policy_value
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE missing_wait, __dummyname_missing_wait
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE scheduler_resource_allocation_error, __dummyname_scheduler_resource_allocation_error
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what)
START_VTABLE ExternalContextBase, __dummyname_ExternalContextBase
VTABLE_ADD_FUNC(ExternalContextBase_GetId)
VTABLE_ADD_FUNC(ExternalContextBase_GetVirtualProcessorId)
VTABLE_ADD_FUNC(ExternalContextBase_GetScheduleGroupId)
VTABLE_ADD_FUNC(ExternalContextBase_Unblock)
VTABLE_ADD_FUNC(ExternalContextBase_IsSynchronouslyBlocked)
VTABLE_ADD_FUNC(ExternalContextBase_vector_dtor)
VTABLE_ADD_FUNC(ExternalContextBase_Block)
VTABLE_ADD_FUNC(ExternalContextBase_Yield)
VTABLE_ADD_FUNC(ExternalContextBase_SpinYield)
VTABLE_ADD_FUNC(ExternalContextBase_Oversubscribe)
VTABLE_ADD_FUNC(ExternalContextBase_Alloc)
VTABLE_ADD_FUNC(ExternalContextBase_Free)
VTABLE_ADD_FUNC(ExternalContextBase_EnterCriticalRegionHelper)
VTABLE_ADD_FUNC(ExternalContextBase_EnterHyperCriticalRegionHelper)
VTABLE_ADD_FUNC(ExternalContextBase_ExitCriticalRegionHelper)
VTABLE_ADD_FUNC(ExternalContextBase_ExitHyperCriticalRegionHelper)
VTABLE_ADD_FUNC(ExternalContextBase_GetCriticalRegionType)
VTABLE_ADD_FUNC(ExternalContextBase_GetContextKind)
START_VTABLE ThreadScheduler, __dummyname_ThreadScheduler
VTABLE_ADD_FUNC(ThreadScheduler_vector_dtor)
VTABLE_ADD_FUNC(ThreadScheduler_Id)
VTABLE_ADD_FUNC(ThreadScheduler_GetNumberOfVirtualProcessors)
VTABLE_ADD_FUNC(ThreadScheduler_GetPolicy)
VTABLE_ADD_FUNC(ThreadScheduler_Reference)
VTABLE_ADD_FUNC(ThreadScheduler_Release)
VTABLE_ADD_FUNC(ThreadScheduler_RegisterShutdownEvent)
VTABLE_ADD_FUNC(ThreadScheduler_Attach)
#if _MSVCR_VER > 100
VTABLE_ADD_FUNC(ThreadScheduler_CreateScheduleGroup_loc)
#endif
VTABLE_ADD_FUNC(ThreadScheduler_CreateScheduleGroup)
#if _MSVCR_VER > 100
VTABLE_ADD_FUNC(ThreadScheduler_ScheduleTask_loc)
#endif
VTABLE_ADD_FUNC(ThreadScheduler_ScheduleTask)
#if _MSVCR_VER > 100
VTABLE_ADD_FUNC(ThreadScheduler_IsAvailableLocation)
#endif
START_VTABLE _Timer, __dummyname__Timer
VTABLE_ADD_FUNC(_Timer_vector_dtor)
END
+71
View File
@@ -0,0 +1,71 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x64 C++ MSVC aliases for cpp.c
* COPYRIGHT: Copyright 2014-2024 Wine team
* Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
// See msvcrt/cpp.c
.code64
MACRO(DEFINE_ALIAS, alias, orig)
EXTERN &orig:ABS
ALIAS <&alias> = <&orig>
ENDM
DEFINE_ALIAS ??3@YAXPEAX@Z, operator_delete
DEFINE_ALIAS ??_U@YAPEAX_K@Z, operator_new
DEFINE_ALIAS ??_U@YAPEAX_KHPEBDH@Z, operator_new_dbg
DEFINE_ALIAS ??_V@YAXPEAX@Z, operator_delete
DEFINE_ALIAS ??2@YAPEAX_K@Z, operator_new
DEFINE_ALIAS ??2@YAPEAX_KHPEBDH@Z, operator_new_dbg
DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, _query_new_handler
DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, _set_new_handler
DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, set_new_handler
DEFINE_ALIAS ?_query_new_mode@@YAHXZ, _query_new_mode
DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, _set_new_mode
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _set_se_translator
DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, set_terminate
DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, set_unexpected
DEFINE_ALIAS ?terminate@@YAXXZ, terminate
DEFINE_ALIAS ?unexpected@@YAXXZ, unexpected
DEFINE_ALIAS ?what@exception@@UEBAPEBDXZ, exception_what
DEFINE_ALIAS ??0exception@@QEAA@AEBQEBDH@Z, exception_ctor_noalloc
DEFINE_ALIAS ??0exception@@QEAA@AEBV0@@Z, exception_copy_ctor
DEFINE_ALIAS ??0exception@@QEAA@XZ, exception_default_ctor
DEFINE_ALIAS ??1exception@@UEAA@XZ, exception_dtor
DEFINE_ALIAS ??4exception@@QEAAAEAV0@AEBV0@@Z, exception_opequals
DEFINE_ALIAS ??1type_info@@UEAA@XZ, type_info_dtor
DEFINE_ALIAS ??0__non_rtti_object@@QEAA@AEBV0@@Z, __non_rtti_object_copy_ctor
DEFINE_ALIAS ??0__non_rtti_object@@QEAA@PEBD@Z, __non_rtti_object_ctor
DEFINE_ALIAS ??0bad_cast@@AAE@PBQBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@AEAA@PEBQEBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@QAE@ABQBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@QEAA@AEBQEBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@QEAA@AEBV0@@Z, bad_cast_copy_ctor
DEFINE_ALIAS ??0bad_cast@@QEAA@PEBD@Z, bad_cast_ctor_charptr
DEFINE_ALIAS ??0bad_typeid@@QEAA@AEBV0@@Z, bad_typeid_copy_ctor
DEFINE_ALIAS ??0bad_typeid@@QEAA@PEBD@Z, bad_typeid_ctor
DEFINE_ALIAS ??0exception@@QEAA@AEBQEBD@Z, exception_ctor
DEFINE_ALIAS ??1__non_rtti_object@@UEAA@XZ, __non_rtti_object_dtor
DEFINE_ALIAS ??1bad_cast@@UEAA@XZ, bad_cast_dtor
DEFINE_ALIAS ??1bad_typeid@@UEAA@XZ, bad_typeid_dtor
DEFINE_ALIAS ??4bad_cast@@QEAAAEAV0@AEBV0@@Z, bad_cast_opequals
DEFINE_ALIAS ??4bad_typeid@@QEAAAEAV0@AEBV0@@Z, bad_typeid_opequals
DEFINE_ALIAS ??8type_info@@QEBAHAEBV0@@Z, type_info_opequals_equals
DEFINE_ALIAS ??9type_info@@QEBAHAEBV0@@Z, type_info_opnot_equals
DEFINE_ALIAS ??_Fbad_cast@@QEAAXXZ, bad_cast_default_ctor
DEFINE_ALIAS ??_Fbad_typeid@@QEAAXXZ, bad_typeid_default_ctor
DEFINE_ALIAS ?_query_new_handler@@YAP6AH_K@ZXZ, _query_new_handler
DEFINE_ALIAS ?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z, _set_new_handler
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _set_se_translator
DEFINE_ALIAS ?before@type_info@@QEBAHAEBV1@@Z, type_info_before
DEFINE_ALIAS ?name@type_info@@QEBAPEBDXZ, type_info_name
DEFINE_ALIAS ?raw_name@type_info@@QEBAPEBDXZ, type_info_raw_name
DEFINE_ALIAS ??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z, __non_rtti_object_opequals
END
+52
View File
@@ -0,0 +1,52 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x64 C++ V-tables for cpp.c
* COPYRIGHT: Copyright 2014-2024 Wine team
* Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
// See msvcrt/cpp.c
.const
MACRO(START_VTABLE, shortname, cxxname)
EXTERN shortname&_rtti:PROC
.quad shortname&_rtti
PUBLIC &shortname&_vtable
&shortname&_vtable:
PUBLIC &cxxname
&cxxname:
ENDM
MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname)
START_VTABLE shortname, cxxname
EXTERN &shortname&_vector_dtor:PROC
.quad &shortname&_vector_dtor
EXTERN exception_what:ABS
.quad exception_what
ENDM
START_VTABLE type_info, __dummyname_type_info
EXTERN type_info_vector_dtor:PROC
.quad type_info_vector_dtor
DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@
DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@
DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
#if 0
START_VTABLE exception_old, __dummyname_exception_old
.quad exception_vector_dtor
.quad exception_what
START_VTABLE bad_alloc, ??_7bad_alloc@@6B@
.quad exception_vector_dtor
.quad exception_what
#endif
END
+29
View File
@@ -0,0 +1,29 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x64 asm code for except_x86_64.c
* COPYRIGHT: Copyright 2017-2024 Wine team
*/
#include <asm.inc>
// See msvcrt/except_x86_64.c
.code64
// void *call_exc_handler( void *handler, ULONG_PTR frame, UINT flags );
PUBLIC call_exc_handler
.PROC call_exc_handler
sub rsp, 40
.allocstack 40
.endprolog
mov [rsp], rcx
mov [rsp + 8], r8d
mov [rsp + 16], rdx
call rcx
add rsp, 40
ret
.ENDP
END
+93
View File
@@ -0,0 +1,93 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x86 C++ MSVC aliases for cpp.c
* COPYRIGHT: Copyright 2014-2024 Wine team
* Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
// See msvcrt/cpp.c
.code
MACRO(DEFINE_THISCALL_ALIAS, cxxname, target)
#ifdef _USE_ML
EXTERN ___thiscall&target:PROC
ALIAS <&cxxname> = <___thiscall&target>
#else
PUBLIC cxxname
.weakref &cxxname, &target
#endif
ENDM
DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABQBD@Z, _exception_ctor
DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABQBDH@Z, _exception_ctor_noalloc
DEFINE_THISCALL_ALIAS ??0exception@@QAE@ABV0@@Z, _exception_copy_ctor
DEFINE_THISCALL_ALIAS ??0exception@@QAE@XZ, _exception_default_ctor
DEFINE_THISCALL_ALIAS ??1exception@@UAE@XZ, _exception_dtor
DEFINE_THISCALL_ALIAS ??4exception@@QAEAAV0@ABV0@@Z, _exception_opequals
DEFINE_THISCALL_ALIAS ??_Eexception@@UAEPAXI@Z, _exception_vector_dtor
DEFINE_THISCALL_ALIAS ??_Gexception@@UAEPAXI@Z, _exception_scalar_dtor
DEFINE_THISCALL_ALIAS ?what@exception@@UBEPBDXZ, _exception_what
DEFINE_THISCALL_ALIAS ??0bad_typeid@@QAE@ABV0@@Z, _bad_typeid_copy_ctor
DEFINE_THISCALL_ALIAS ??0bad_typeid@@QAE@PBD@Z, _bad_typeid_ctor
DEFINE_THISCALL_ALIAS ??_Fbad_typeid@@QAEXXZ, _bad_typeid_default_ctor
DEFINE_THISCALL_ALIAS ??1bad_typeid@@UAE@XZ, _bad_typeid_dtor
DEFINE_THISCALL_ALIAS ??4bad_typeid@@QAEAAV0@ABV0@@Z, _bad_typeid_opequals
DEFINE_THISCALL_ALIAS ??_Ebad_typeid@@UAEPAXI@Z, _bad_typeid_vector_dtor
DEFINE_THISCALL_ALIAS ??_Gbad_typeid@@UAEPAXI@Z, _bad_typeid_scalar_dtor
DEFINE_THISCALL_ALIAS ??0__non_rtti_object@@QAE@ABV0@@Z, ___non_rtti_object_copy_ctor
DEFINE_THISCALL_ALIAS ??0__non_rtti_object@@QAE@PBD@Z, ___non_rtti_object_ctor
DEFINE_THISCALL_ALIAS ??1__non_rtti_object@@UAE@XZ, ___non_rtti_object_dtor
DEFINE_THISCALL_ALIAS ??4__non_rtti_object@@QAEAAV0@ABV0@@Z, ___non_rtti_object_opequals
DEFINE_THISCALL_ALIAS ??_E__non_rtti_object@@UAEPAXI@Z, ___non_rtti_object_vector_dtor
DEFINE_THISCALL_ALIAS ??_G__non_rtti_object@@UAEPAXI@Z, ___non_rtti_object_scalar_dtor
DEFINE_THISCALL_ALIAS ??0bad_cast@@AAE@PBQBD@Z, _bad_cast_ctor
DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@ABQBD@Z, _bad_cast_ctor
DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@ABV0@@Z, _bad_cast_copy_ctor
DEFINE_THISCALL_ALIAS ??0bad_cast@@QAE@PBD@Z, _bad_cast_ctor_charptr
DEFINE_THISCALL_ALIAS ??_Fbad_cast@@QAEXXZ, _bad_cast_default_ctor
DEFINE_THISCALL_ALIAS ??1bad_cast@@UAE@XZ, _bad_cast_dtor
DEFINE_THISCALL_ALIAS ??4bad_cast@@QAEAAV0@ABV0@@Z, _bad_cast_opequals
DEFINE_THISCALL_ALIAS ??_Ebad_cast@@UAEPAXI@Z, _bad_cast_vector_dtor
DEFINE_THISCALL_ALIAS ??_Gbad_cast@@UAEPAXI@Z, _bad_cast_scalar_dtor
DEFINE_THISCALL_ALIAS ??8type_info@@QBEHABV0@@Z, _type_info_opequals_equals
DEFINE_THISCALL_ALIAS ??9type_info@@QBEHABV0@@Z, _type_info_opnot_equals
DEFINE_THISCALL_ALIAS ?before@type_info@@QBEHABV1@@Z, _type_info_before
DEFINE_THISCALL_ALIAS ??1type_info@@UAE@XZ, _type_info_dtor
DEFINE_THISCALL_ALIAS ?name@type_info@@QBEPBDXZ, _type_info_name
DEFINE_THISCALL_ALIAS ?raw_name@type_info@@QBEPBDXZ, _type_info_raw_name
EXTERN _operator_delete:PROC
PUBLIC ??3@YAXPAX@Z
??3@YAXPAX@Z:
jmp _operator_delete
EXTERN _operator_new:PROC
PUBLIC ??_U@YAPAXI@Z
??_U@YAPAXI@Z:
jmp _operator_new
MACRO(DEFINE_ALIAS, alias, orig, type)
EXTERN &orig:&type
ALIAS <&alias> = <&orig>
ENDM
DEFINE_ALIAS ??_V@YAXPAX@Z, _operator_delete, PROC
DEFINE_ALIAS ??2@YAPAXI@Z, _operator_new, PROC
DEFINE_ALIAS ??2@YAPAXIHPBDH@Z, _operator_new, PROC
DEFINE_ALIAS ??_U@YAPAXIHPBDH@Z, _operator_new_dbg, PROC
DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, __query_new_handler, PROC
DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, __set_new_handler, PROC
DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, _set_new_handler, PROC
DEFINE_ALIAS ?_query_new_mode@@YAHXZ, __query_new_mode, PROC
DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, __set_new_mode, PROC
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, __set_se_translator, PROC
DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, _set_terminate, PROC
DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, _set_unexpected, PROC
DEFINE_ALIAS ?terminate@@YAXXZ, _terminate, PROC
DEFINE_ALIAS ?unexpected@@YAXXZ, _unexpected, PROC
END
+53
View File
@@ -0,0 +1,53 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x64 C++ V-tables for cpp.c
* COPYRIGHT: Copyright 2014-2024 Wine team
* Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
// See msvcrt/cpp.c
.const
ASSUME CS:NOTHING
MACRO(START_VTABLE, shortname, cxxname)
EXTERN _&shortname&_rtti:PROC
.long _&shortname&_rtti
PUBLIC _&shortname&_vtable
_&shortname&_vtable:
PUBLIC &cxxname
&cxxname:
ENDM
MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname)
START_VTABLE shortname, cxxname
EXTERN ___thiscall_&shortname&_vector_dtor:PROC
.long ___thiscall_&shortname&_vector_dtor
EXTERN ___thiscall_exception_what:PROC
.long ___thiscall_exception_what
ENDM
START_VTABLE type_info, __dummyname_type_info
EXTERN ___thiscall_type_info_vector_dtor:PROC
.long ___thiscall_type_info_vector_dtor
DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@
DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@
DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
#if 0
START_VTABLE exception_old, __dummyname_exception_old
.long ___thiscall_exception_vector_dtor
.long ___thiscall_exception_what
START_VTABLE bad_alloc, ??_7bad_alloc@@6B@
.long ___thiscall_exception_vector_dtor
.long ___thiscall_exception_what
#endif
END
+124
View File
@@ -0,0 +1,124 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x686 asm code for except_i386.c
* COPYRIGHT: Copyright 2017-2024 Wine team
*/
#include <asm.inc>
// See msvcrt/except_i386.c
.code
PUBLIC _continue_after_catch
_continue_after_catch:
mov edx, [esp + 4]
mov eax, [esp + 8]
mov esp, [edx - 4]
lea ebp, [edx + 12]
jmp eax
PUBLIC _call_finally_block
_call_finally_block:
mov ebp, [esp + 8]
jmp dword ptr [esp + 4]
PUBLIC _call_filter
_call_filter:
push ebp
push dword ptr [esp + 12]
mov ebp, [esp + 20]
call dword ptr [esp + 12]
pop ebp
pop ebp
ret
PUBLIC _call_handler
_call_handler:
push ebp
push ebx
push esi
push edi
mov ebp, [esp + 24]
call dword ptr [esp + 20]
pop edi
pop esi
pop ebx
pop ebp
ret
//
// DWORD
// __cdecl
// __CxxFrameHandler(
// PEXCEPTION_RECORD rec,
// EXCEPTION_REGISTRATION_RECORD* frame,
// PCONTEXT context,
// EXCEPTION_REGISTRATION_RECORD** dispatch);
//
// See except_i386.c
//
EXTERN _cxx_frame_handler:PROC
PUBLIC ___CxxFrameHandler
___CxxFrameHandler:
push 0 /* nested_trylevel */
//.cfi_adjust_cfa_offset 4
push 0 /* nested_frame */
//.cfi_adjust_cfa_offset 4
push eax /* descr */
//.cfi_adjust_cfa_offset 4
push [esp + 28] /* dispatch */
//.cfi_adjust_cfa_offset 4
push [esp + 28] /* context */
//.cfi_adjust_cfa_offset 4
push [esp + 28] /* frame */
//.cfi_adjust_cfa_offset 4
push [esp + 28] /* rec */
//.cfi_adjust_cfa_offset 4
call _cxx_frame_handler
add esp, 28
//.cfi_adjust_cfa_offset -28
ret
PUBLIC __EH_prolog
__EH_prolog:
//.cfi_adjust_cfa_offset 4
push -1
//.cfi_adjust_cfa_offset 4
push eax
//.cfi_adjust_cfa_offset 4
push fs:0
//.cfi_adjust_cfa_offset 4
mov fs:0, esp
mov eax, [esp + 12]
mov [esp + 12], ebp
lea ebp, [esp + 12]
push eax
//.cfi_adjust_cfa_offset 4
ret
PUBLIC _call_copy_ctor
_call_copy_ctor:
push ebp
//.cfi_adjust_cfa_offset 4
//.cfi_rel_offset ebp, 0
mov ebp, esp
//.cfi_def_cfa_register ebp
push 1
mov ecx, [ebp + 12]
push dword ptr [ebp + 16]
call dword ptr [ebp + 8]
//.cfi_def_cfa esp, 4
//.cfi_same_value ebp
leave
ret
PUBLIC _call_dtor
_call_dtor:
mov ecx, [esp + 8]
call dword ptr [esp + 4]
ret
END
+51
View File
@@ -0,0 +1,51 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: x86 asm implementation of _inp, _inpw, _inpd
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
.code
PUBLIC __inp
__inp:
mov dx, [esp + 8]
in al, dx
ret
PUBLIC __inpw
__inpw:
mov dx, [esp + 8]
in ax, dx
ret
PUBLIC __inpd
__inpd:
mov dx, [esp + 8]
in eax, dx
ret
PUBLIC __outp
__outp:
mov dx, [esp + 8]
mov al, [esp + 12]
out dx, al
ret
PUBLIC __outpw
__outpw:
mov dx, [esp + 8]
mov ax, [esp + 12]
out dx, ax
ret
PUBLIC __outpd
__outpd:
mov dx, [esp + 8]
mov eax, [esp + 12]
out dx, eax
ret
END