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

Last change on this file since 4189 was 4189, checked in by sandervl, 25 years ago

GetDiskFreeSpace(Ex) changes/fixes

File size: 4.2 KB
Line 
1; $Id: exceptutil.asm,v 1.10 2000-09-04 18:24:42 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 public _RaiseException@16
15 extrn OS2RAISEEXCEPTION : near
16
17_RaiseException@16 proc near
18 push dword ptr [esp+4] ;DWORD dwExceptionCode
19 push dword ptr [esp+12] ;DWORD dwExceptionFlags
20 push dword ptr [esp+20] ;DWORD cArguments
21 push dword ptr [esp+28] ;DWORD *lpArguments
22 push dword ptr [esp+16] ;return address
23 push esp
24 add dword ptr [esp], 20
25 push ebp
26 pushfd
27 push eax
28 push ebx
29 push ecx
30 push edx
31 push edi
32 push esi
33 xor eax, eax
34 mov eax, cs
35 push eax
36 mov eax, ds
37 push eax
38 mov eax, es
39 push eax
40 mov eax, fs
41 push eax
42 mov eax, gs
43 push eax
44 mov eax, ss
45 push eax
46 call OS2RAISEEXCEPTION
47
48 ret 16 ;__stdcall
49_RaiseException@16 endp
50
51 public _RtlUnwind@16
52 extrn OS2RTLUNWIND : near
53
54_RtlUnwind@16 proc near
55 push dword ptr [esp+4] ;PWINEXCEPTION_FRAME pEndFrame
56 push dword ptr [esp+12] ;LPVOID unusedEip
57 push dword ptr [esp+20] ;PWINEXCEPTION_RECORD pRecord
58 push dword ptr [esp+28] ;DWORD returnEax
59 push dword ptr [esp+16] ;return address
60 push esp
61 add dword ptr [esp], 20
62 push ebp
63 pushfd
64 push eax
65 push ebx
66 push ecx
67 push edx
68 push edi
69 push esi
70 xor eax, eax
71 mov eax, cs
72 push eax
73 mov eax, ds
74 push eax
75 mov eax, es
76 push eax
77 mov eax, fs
78 push eax
79 mov eax, gs
80 push eax
81 mov eax, ss
82 push eax
83 call OS2RTLUNWIND
84
85 ret 16 ;__stdcall
86_RtlUnwind@16 endp
87
88
89 PUBLIC QueryExceptionChain
90
91QueryExceptionChain proc near
92 mov eax, fs:[0]
93 ret
94QueryExceptionChain endp
95
96 PUBLIC GetExceptionRecord
97GetExceptionRecord proc near
98 push ebp
99 mov ebp, esp
100 push fs
101 push ebx
102
103 mov eax, [ebp+8]
104 mov fs, eax
105 mov ebx, [ebp+12]
106 mov eax, fs:[ebx]
107
108 pop ebx
109 pop fs
110 pop ebp
111 ret
112GetExceptionRecord endp
113
114 PUBLIC ChangeTIBStack
115ChangeTIBStack proc near
116; xor eax, eax
117 push ebx
118 mov eax, fs:[4]
119 mov ebx, fs:[8]
120 add ebx, 8
121 mov fs:[4], ebx
122 mov fs:[8], eax
123 pop ebx
124 ret
125ChangeTIBStack endp
126
127 PUBLIC _SetExceptionChain
128
129_SetExceptionChain proc near
130 mov eax, dword ptr [esp+4]
131 mov fs:[0], eax
132 ret
133_SetExceptionChain endp
134
135 PUBLIC getEAX
136 PUBLIC getEBX
137getEAX proc near
138 ret
139getEAX endp
140
141getEBX proc near
142 mov eax, ebx
143 ret
144getEBX endp
145
146 PUBLIC GetFS
147GetFS proc near
148 mov eax, fs
149 ret
150GetFS endp
151
152 PUBLIC SetFS
153SetFS proc near
154 mov eax, [esp+4]
155 mov fs, eax
156 ret
157SetFS endp
158
159 PUBLIC getCS
160getCS proc near
161 mov eax, cs
162 ret
163getCS endp
164
165 PUBLIC getDS
166getDS proc near
167 mov eax, ds
168 ret
169getDS endp
170
171 PUBLIC SetReturnFS
172SetReturnFS proc near
173 push fs
174 mov eax, [esp+8]
175 mov fs, eax
176 pop eax
177 ret
178SetReturnFS endp
179
180 PUBLIC getSS
181getSS proc near
182 mov ax, ss
183 ret
184getSS endp
185
186 PUBLIC getES
187getES proc near
188 mov eax, es
189 ret
190getES endp
191
192 PUBLIC getGS
193getGS proc near
194 mov eax, gs
195 ret
196getGS endp
197
198 PUBLIC getESP
199getESP proc near
200 mov eax, esp
201 ret
202getESP endp
203
204 PUBLIC RestoreOS2FS
205RestoreOS2FS proc near
206 push 150bh
207 mov ax, fs
208 pop fs
209 ret
210RestoreOS2FS endp
211
212 PUBLIC _Mul32x32to64
213_Mul32x32to64 proc near
214 push ebp
215 mov ebp, esp
216 push eax
217 push edx
218 push edi
219
220 mov edi, [ebp+8] ;64 bits result
221 mov eax, [ebp+12] ;op1
222 mov edx, [ebp+16] ;op2
223 mul edx
224 mov [edi], eax
225 mov [edi+4], edx
226
227 pop edi
228 pop edx
229 pop eax
230 pop ebp
231 ret
232_Mul32x32to64 endp
233
234CODE32 ENDS
235
236 END
Note: See TracBrowser for help on using the repository browser.