xref: /reactos/sdk/lib/crt/except/i386/cpp.s (revision 3b3741c1)
1
2
3#include <asm.inc>
4
5.code
6.align 4
7
8EXTERN _cxx_frame_handler:PROC
9
10#undef _MSVCRT_
11MACRO(START_VTABLE, shortname, cxxname)
12EXTERN _&shortname&_rtti:PROC
13EXTERN ___thiscall_&shortname&_vector_dtor:PROC
14    .long _&shortname&_rtti
15PUBLIC _&shortname&_vtable
16_&shortname&_vtable:
17PUBLIC &cxxname
18&cxxname:
19    .long ___thiscall_&shortname&_vector_dtor
20ENDM
21
22MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname)
23    START_VTABLE shortname, cxxname
24    EXTERN ___thiscall_exception_what:PROC
25    .long ___thiscall_exception_what
26ENDM
27
28START_VTABLE type_info, __dummyname_type_info
29DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@
30DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@
31DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
32DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
33
34// void call_copy_ctor( void *func, void *this, void *src, int has_vbase );
35PUBLIC _call_copy_ctor
36_call_copy_ctor:
37    push ebp
38    CFI_ADJUST_CFA_OFFSET 4
39    CFI_REL_OFFSET ebp, 0
40    mov ebp, esp
41    CFI_DEF_CFA_REGISTER ebp
42    push 1
43    mov ecx, [ebp + 12]
44    push dword ptr [ebp + 16]
45    call dword ptr [ebp + 8]
46    leave
47    CFI_DEF_CFA esp, 4
48    CFI_SAME_VALUE ebp
49    ret
50
51// void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr );
52PUBLIC _continue_after_catch
53_continue_after_catch:
54    mov edx, [esp + 4]
55    mov eax, [esp + 8]
56    mov esp, [edx - 4]
57    lea ebp, [edx + 12]
58    jmp eax
59
60// void DECLSPEC_NORETURN call_finally_block( void *code_block, void *base_ptr );
61PUBLIC _call_finally_block
62_call_finally_block:
63    mov ebp, [esp +8]
64    jmp dword ptr [esp + 4]
65
66// int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void *ebp );
67PUBLIC _call_filter
68_call_filter:
69    push ebp
70    push [esp + 12]
71    mov ebp, [esp + 20]
72    call dword ptr [esp + 12]
73    pop ebp
74    pop ebp
75    ret
76
77// void *call_handler( void * (*func)(void), void *ebp );
78PUBLIC _call_handler
79_call_handler:
80    push ebp
81    push ebx
82    push esi
83    push edi
84    mov ebp, [esp + 24]
85    call dword ptr [esp + 20]
86    pop edi
87    pop esi
88    pop ebx
89    pop ebp
90    ret
91
92
93PUBLIC ___CxxFrameHandler
94___CxxFrameHandler:
95    push 0
96    push 0
97    push eax
98    push[esp + 28]
99    push[esp + 28]
100    push[esp + 28]
101    push[esp + 28]
102    call _cxx_frame_handler
103    add esp, 28
104    ret
105
106END
107
108