summaryrefslogtreecommitdiffstats
path: root/chrome_frame/exception_barrier_lowlevel.asm
blob: 949195df087e45d2992773bf64458ebbee93d2e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; Copyright (c) 2010 The Chromium Authors. All rights reserved.
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
;
; Tag the exception handler as an SEH handler in case the executable
; is linked with /SAFESEH (which is the default).
;
; MASM 8.0 inserts an additional leading underscore in front of names
; and this is an attempted fix until we understand why.
; MASM 10.0 fixed this.
IF @version LT 800 OR @version GE 1000
_ExceptionBarrierHandler PROTO
.SAFESEH _ExceptionBarrierHandler
_ExceptionBarrierReportOnlyModuleHandler PROTO
.SAFESEH _ExceptionBarrierReportOnlyModuleHandler
_ExceptionBarrierCallCustomHandler PROTO
.SAFESEH _ExceptionBarrierCallCustomHandler
ELSE
ExceptionBarrierHandler PROTO
.SAFESEH ExceptionBarrierHandler
ExceptionBarrierReportOnlyModuleHandler PROTO
.SAFESEH ExceptionBarrierReportOnlyModuleHandler
ExceptionBarrierCallCustomHandler PROTO
.SAFESEH ExceptionBarrierCallCustomHandler
ENDIF

.586
.MODEL FLAT, STDCALL
ASSUME FS:NOTHING
.CODE

; extern "C" void WINAPI RegisterExceptionRecord(
;                          EXCEPTION_REGISTRATION *registration,
;                          ExceptionHandlerFunc func);
RegisterExceptionRecord PROC registration:DWORD, func:DWORD
OPTION PROLOGUE:None
OPTION EPILOGUE:None
  mov   edx, DWORD PTR [esp + 4]  ; edx is registration
  mov   eax, DWORD PTR [esp + 8] ; eax is func
  mov   DWORD PTR [edx + 4], eax
  mov   eax, FS:[0]
  mov   DWORD PTR [edx], eax
  mov   FS:[0], edx
  ret   8

RegisterExceptionRecord ENDP

; extern "C" void UnregisterExceptionRecord(
;                           EXCEPTION_REGISTRATION *registration);
UnregisterExceptionRecord PROC registration:DWORD
OPTION PROLOGUE:None
OPTION EPILOGUE:None

  mov   edx, DWORD PTR [esp + 4]
  mov   eax, [edx]
  mov   FS:[0], eax
  ret   4

UnregisterExceptionRecord ENDP

END