source: trunk/src/kernel32/exceptutil.asm@ 620

Last change on this file since 620 was 620, checked in by sandervl, 26 years ago

* empty log message *

File size: 4.0 KB
Line 
1; $Id: exceptutil.asm,v 1.1 1999-08-22 12:55:57 sandervl Exp $
2
3;/*
4; * Project Odin Software License can be found in LICENSE.TXT
5; * Win32 Exception handling + misc functions for OS/2
6; *
7; * Copyright 1998 Sander van Leeuwen
8; *
9; */
10.386p
11 NAME except
12
13CODE32 SEGMENT DWORD PUBLIC USE32 'CODE'
14 ASSUME CS:FLAT ,DS:FLAT,SS:FLAT
15 public RaiseExceptionAsm
16 extrn OS2RAISEEXCEPTION : near
17
18RaiseExceptionAsm proc near
19 push dword ptr [esp+4] ;DWORD dwExceptionCode
20 push dword ptr [esp+12] ;DWORD dwExceptionFlags
21 push dword ptr [esp+20] ;DWORD cArguments
22 push dword ptr [esp+28] ;DWORD *lpArguments
23 push dword ptr [esp+16] ;return address
24 push esp
25 sub dword ptr [esp-4], 20
26 push ebp
27 pushfd
28 push eax
29 push ebx
30 push ecx
31 push edx
32 push edi
33 push esi
34 xor eax, eax
35 mov eax, cs ;does 'push cs' push a dword??
36 push eax
37 mov eax, ds
38 push eax
39 mov eax, es
40 push eax
41 mov eax, fs
42 push eax
43 mov eax, gs
44 push eax
45 mov eax, ss
46 push eax
47 call OS2RAISEEXCEPTION
48
49 ret 20 ;__stdcall
50RaiseExceptionAsm endp
51
52 public RtlUnwindAsm
53 extrn OS2RTLUNWIND : near
54
55RtlUnwindAsm proc near
56 push dword ptr [esp+4] ;PWINEXCEPTION_FRAME pEndFrame
57 push dword ptr [esp+12] ;LPVOID unusedEip
58 push dword ptr [esp+20] ;PWINEXCEPTION_RECORD pRecord
59 push dword ptr [esp+28] ;DWORD returnEax
60 push dword ptr [esp+16] ;return address
61 push esp
62 sub dword ptr [esp-4], 20
63 push ebp
64 pushfd
65 push eax
66 push ebx
67 push ecx
68 push edx
69 push edi
70 push esi
71 xor eax, eax
72 mov eax, cs ;does 'push cs' push a dword??
73 push eax
74 mov eax, ds
75 push eax
76 mov eax, es
77 push eax
78 mov eax, fs
79 push eax
80 mov eax, gs
81 push eax
82 mov eax, ss
83 push eax
84 call OS2RTLUNWIND
85
86 ret 20 ;__stdcall
87RtlUnwindAsm endp
88
89
90 PUBLIC QueryExceptionChain
91
92QueryExceptionChain proc near
93 mov eax, fs:[0]
94 ret
95QueryExceptionChain endp
96
97 PUBLIC GetExceptionRecord
98GetExceptionRecord proc near
99 push ebp
100 mov ebp, esp
101 push fs
102 push ebx
103
104 mov eax, [ebp+8]
105 mov fs, eax
106 mov ebx, [ebp+12]
107 mov eax, fs:[ebx]
108
109 pop ebx
110 pop fs
111 pop ebp
112 ret
113GetExceptionRecord endp
114
115 PUBLIC ChangeTIBStack
116ChangeTIBStack proc near
117; xor eax, eax
118 push ebx
119 mov eax, fs:[4]
120 mov ebx, fs:[8]
121 add ebx, 8
122 mov fs:[4], ebx
123 mov fs:[8], eax
124 pop ebx
125 ret
126ChangeTIBStack endp
127
128 PUBLIC _SetExceptionChain
129
130_SetExceptionChain proc near
131 mov eax, dword ptr [esp+4]
132 mov fs:[0], eax
133 ret
134_SetExceptionChain endp
135
136 PUBLIC DisableFPUExceptions
137DisableFPUExceptions proc near
138 push eax
139 push 67Fh
140 fldcw word ptr [esp]
141 pop eax
142 pop eax
143 ret
144DisableFPUExceptions endp
145
146 PUBLIC GetDllEntryPoint
147
148GetDllEntryPoint proc near
149 mov eax, [ebp + 4] ; return address in win32 dll
150 ret
151GetDllEntryPoint endp
152
153 PUBLIC getEAX
154 PUBLIC getEBX
155getEAX proc near
156 ret
157getEAX endp
158
159getEBX proc near
160 mov eax, ebx
161 ret
162getEBX endp
163
164 PUBLIC GetFS
165GetFS proc near
166 mov eax, fs
167 ret
168GetFS endp
169
170 PUBLIC SetFS
171SetFS proc near
172 mov eax, [esp+4]
173 mov fs, eax
174 ret
175SetFS endp
176
177 PUBLIC SetReturnFS
178SetReturnFS proc near
179 push fs
180 mov eax, [esp+8]
181 mov fs, eax
182 pop eax
183 ret
184SetReturnFS endp
185
186 PUBLIC getSS
187getSS proc near
188 mov ax, ss
189 ret
190getSS endp
191
192 PUBLIC RestoreOS2FS
193RestoreOS2FS proc near
194 push 150bh
195 mov ax, fs
196 pop fs
197 ret
198RestoreOS2FS endp
199CODE32 ENDS
200
201 END
Note: See TracBrowser for help on using the repository browser.