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
15 .extern __SEH3$_except_handler
19 * _SEH3$_RegisterFrame(
20 * PSEH_REGISTRATION_FRAME RegistrationRecord<ecx>,
21 * PSEH_DATA_TABLE DataTable<eax>);
23 .global __SEH3$_RegisterFrame
24 __SEH3$_RegisterFrame:
26 /* Save the address of the static data table */
27 mov [ecx + SEH3_REGISTRATION_FRAME_ScopeTable], eax
29 /* Set the handler address */
30 mov dword ptr [ecx + SEH3_REGISTRATION_FRAME_Handler], offset __SEH3$_except_handler
32 /* Set this as the end of the internal chain */
33 mov dword ptr [ecx + SEH3_REGISTRATION_FRAME_EndOfChain], ecx
35 /* Register the frame in the TEB */
36 mov eax, dword ptr fs:[0]
37 mov [ecx + SEH3_REGISTRATION_FRAME_Next], eax
38 mov dword ptr fs:[0], ecx
40 /* Save the registers */
41 mov [ecx + SEH3_REGISTRATION_FRAME_Esp], esp
42 mov [ecx + SEH3_REGISTRATION_FRAME_Ebp], ebp
47 .global __SEH3$_RegisterTryLevel
48 __SEH3$_RegisterTryLevel:
50 /* Save the address of the static data table */
51 mov [ecx + SEH3_REGISTRATION_FRAME_ScopeTable], eax
53 /* Set the handler address to NULL as identification */
54 and dword ptr [ecx + SEH3_REGISTRATION_FRAME_Handler], 0
56 /* Get the current registered frame */
57 mov eax, dword ptr fs:[0]
59 /* Get the current end of the chain and set this as Next */
60 mov edx, [eax + SEH3_REGISTRATION_FRAME_EndOfChain]
61 mov [ecx + SEH3_REGISTRATION_FRAME_Next], edx
63 /* Set this as the end of the internal chain */
64 mov dword ptr [eax + SEH3_REGISTRATION_FRAME_EndOfChain], ecx
66 /* Save the registers */
67 mov [ecx + SEH3_REGISTRATION_FRAME_Esp], esp
68 mov [ecx + SEH3_REGISTRATION_FRAME_Ebp], ebp