2 * PROJECT: ReactOS system libraries
3 * LICENSE: GNU GPL - See COPYING in the top level directory
4 * PURPOSE: Support library for PSEH3
5 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
8 #include "pseh3_asmdef.h"
10 .intel_syntax noprefix
14 .extern __SEH3$_except_handler
18 * __attribute__((regparm(2)))
19 * __attribute__((returns_twice))
20 * _SEH3$_RegisterFrame[WithNonVolatiles](
21 * PSEH3$_REGISTRATION_FRAME RegistrationFrame<eax>,
22 * PSEH3$_SCOPE_TABLE ScopeTable<edx>);
24 .global __SEH3$_RegisterFrameWithNonVolatiles
25 __SEH3$_RegisterFrameWithNonVolatiles:
27 /* Save non-volatiles in the registration frame */
28 mov [eax + SEH3_REGISTRATION_FRAME_Ebx], ebx
29 mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi
30 mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi
32 .global __SEH3$_RegisterFrame
33 __SEH3$_RegisterFrame:
35 /* Save the address of the static data table */
36 mov [eax + SEH3_REGISTRATION_FRAME_ScopeTable], edx
38 /* Set the handler address */
39 mov dword ptr [eax + SEH3_REGISTRATION_FRAME_Handler], offset __SEH3$_except_handler
41 /* Set this as the end of the internal chain */
42 mov dword ptr [eax + SEH3_REGISTRATION_FRAME_EndOfChain], eax
44 /* Register the frame in the TEB */
45 mov edx, dword ptr fs:[0]
46 mov [eax + SEH3_REGISTRATION_FRAME_Next], edx
47 mov dword ptr fs:[0], eax
49 /* Save the stack registers */
50 mov [eax + SEH3_REGISTRATION_FRAME_Esp], esp
51 mov [eax + SEH3_REGISTRATION_FRAME_Ebp], ebp
53 /* Set eax to 0 to indicate 1st return */
60 * __attribute__((regparm(2)))
61 * __attribute__((returns_twice))
62 * _SEH3$_RegisterTryLevel[WithNonVolatiles](
63 * PSEH3$_REGISTRATION_FRAME RegistrationFrame<edx>,
64 * PSEH3$_SCOPE_TABLE ScopeTable<eax>);
66 .global __SEH3$_RegisterTryLevelWithNonVolatiles
67 __SEH3$_RegisterTryLevelWithNonVolatiles:
69 /* Save non-volatiles in the registration frame */
70 mov [eax + SEH3_REGISTRATION_FRAME_Ebx], ebx
71 mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi
72 mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi
74 .global __SEH3$_RegisterTryLevel
75 __SEH3$_RegisterTryLevel:
77 /* Save the address of the static data table */
78 mov [eax + SEH3_REGISTRATION_FRAME_ScopeTable], edx
80 /* Set the handler address to NULL as identification */
81 and dword ptr [eax + SEH3_REGISTRATION_FRAME_Handler], 0
83 /* Get the current registered frame */
84 mov edx, dword ptr fs:[0]
86 /* Get the current end of the chain and set this as Next */
87 mov ecx, [edx + SEH3_REGISTRATION_FRAME_EndOfChain]
88 mov [eax + SEH3_REGISTRATION_FRAME_Next], ecx
90 /* Set this as the end of the internal chain */
91 mov dword ptr [edx + SEH3_REGISTRATION_FRAME_EndOfChain], eax
93 /* Save the stack registers */
94 mov [eax + SEH3_REGISTRATION_FRAME_Esp], esp
95 mov [eax + SEH3_REGISTRATION_FRAME_Ebp], ebp
97 /* Set eax to 0 to indicate 1st return */