- add sources.
[platform/framework/web/crosswalk.git] / src / chrome_frame / exception_barrier_lowlevel.asm
1 ; Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 ; Use of this source code is governed by a BSD-style license that can be
3 ; found in the LICENSE file.
4 ;
5 ; Tag the exception handler as an SEH handler in case the executable
6 ; is linked with /SAFESEH (which is the default).
7 ;
8 ; MASM 8.0 inserts an additional leading underscore in front of names
9 ; and this is an attempted fix until we understand why.
10 ; MASM 10.0 fixed this.
11 IF @version LT 800 OR @version GE 1000
12 _ExceptionBarrierHandler PROTO
13 .SAFESEH _ExceptionBarrierHandler
14 _ExceptionBarrierReportOnlyModuleHandler PROTO
15 .SAFESEH _ExceptionBarrierReportOnlyModuleHandler
16 _ExceptionBarrierCallCustomHandler PROTO
17 .SAFESEH _ExceptionBarrierCallCustomHandler
18 ELSE
19 ExceptionBarrierHandler PROTO
20 .SAFESEH ExceptionBarrierHandler
21 ExceptionBarrierReportOnlyModuleHandler PROTO
22 .SAFESEH ExceptionBarrierReportOnlyModuleHandler
23 ExceptionBarrierCallCustomHandler PROTO
24 .SAFESEH ExceptionBarrierCallCustomHandler
25 ENDIF
26
27 .586
28 .MODEL FLAT, STDCALL
29 ASSUME FS:NOTHING
30 .CODE
31
32 ; extern "C" void WINAPI RegisterExceptionRecord(
33 ;                          EXCEPTION_REGISTRATION *registration,
34 ;                          ExceptionHandlerFunc func);
35 RegisterExceptionRecord PROC registration:DWORD, func:DWORD
36 OPTION PROLOGUE:None
37 OPTION EPILOGUE:None
38   mov   edx, DWORD PTR [esp + 4]  ; edx is registration
39   mov   eax, DWORD PTR [esp + 8] ; eax is func
40   mov   DWORD PTR [edx + 4], eax
41   mov   eax, FS:[0]
42   mov   DWORD PTR [edx], eax
43   mov   FS:[0], edx
44   ret   8
45
46 RegisterExceptionRecord ENDP
47
48 ; extern "C" void UnregisterExceptionRecord(
49 ;                           EXCEPTION_REGISTRATION *registration);
50 UnregisterExceptionRecord PROC registration:DWORD
51 OPTION PROLOGUE:None
52 OPTION EPILOGUE:None
53
54   mov   edx, DWORD PTR [esp + 4]
55   mov   eax, [edx]
56   mov   FS:[0], eax
57   ret   4
58
59 UnregisterExceptionRecord ENDP
60
61 END