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

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

exception changes, implemented enumresourcelanguages + put back some old code

File size: 4.7 KB
Line 
1; $Id: exceptutil.asm,v 1.11 2000-09-08 18:07:49 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 ; fudge return address
56 push eax
57 mov eax, dword ptr [esp+12]
58 mov dword ptr [esp+4], eax
59 pop eax
60
61 push dword ptr [esp+4] ;PWINEXCEPTION_FRAME pEndFrame
62 push dword ptr [esp+12] ;LPVOID unusedEip
63 push dword ptr [esp+20] ;PWINEXCEPTION_RECORD pRecord
64 push dword ptr [esp+28] ;DWORD returnEax
65 push dword ptr [esp+16] ;return address
66 push esp
67 add dword ptr [esp], 20
68 push ebp
69 pushfd
70 push eax
71 push ebx
72 push ecx
73 push edx
74 push edi
75 push esi
76 xor eax, eax
77 mov eax, cs
78 push eax
79 mov eax, ds
80 push eax
81 mov eax, es
82 push eax
83 mov eax, fs
84 push eax
85 mov eax, gs
86 push eax
87 mov eax, ss
88 push eax
89 call OS2RTLUNWIND
90
91 ret 16 ;__stdcall
92_RtlUnwind@16 endp
93
94
95 PUBLIC QueryExceptionChain
96
97QueryExceptionChain proc near
98 mov eax, fs:[0]
99 ret
100QueryExceptionChain endp
101
102 PUBLIC GetExceptionRecord
103GetExceptionRecord proc near
104 push ebp
105 mov ebp, esp
106 push fs
107 push ebx
108
109 mov eax, [ebp+8]
110 mov fs, eax
111 mov ebx, [ebp+12]
112 mov eax, fs:[ebx]
113
114 pop ebx
115 pop fs
116 pop ebp
117 ret
118GetExceptionRecord endp
119
120 PUBLIC ChangeTIBStack
121ChangeTIBStack proc near
122; xor eax, eax
123 push ebx
124 mov eax, fs:[4]
125 mov ebx, fs:[8]
126 add ebx, 8
127 mov fs:[4], ebx
128 mov fs:[8], eax
129 pop ebx
130 ret
131ChangeTIBStack endp
132
133 PUBLIC _SetExceptionChain
134
135_SetExceptionChain proc near
136 mov eax, dword ptr [esp+4]
137 mov fs:[0], eax
138 ret
139_SetExceptionChain endp
140
141 PUBLIC getEAX
142 PUBLIC getEBX
143getEAX proc near
144 ret
145getEAX endp
146
147getEBX proc near
148 mov eax, ebx
149 ret
150getEBX endp
151
152 PUBLIC GetFS
153GetFS proc near
154 mov eax, fs
155 ret
156GetFS endp
157
158 PUBLIC SetFS
159SetFS proc near
160 mov eax, [esp+4]
161 mov fs, eax
162 ret
163SetFS endp
164
165 PUBLIC getCS
166getCS proc near
167 mov eax, cs
168 ret
169getCS endp
170
171 PUBLIC getDS
172getDS proc near
173 mov eax, ds
174 ret
175getDS 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 getES
193getES proc near
194 mov eax, es
195 ret
196getES endp
197
198 PUBLIC getGS
199getGS proc near
200 mov eax, gs
201 ret
202getGS endp
203
204 PUBLIC getESP
205getESP proc near
206 mov eax, esp
207 ret
208getESP endp
209
210 PUBLIC RestoreOS2FS
211RestoreOS2FS proc near
212 push 150bh
213 mov ax, fs
214 pop fs
215 ret
216RestoreOS2FS endp
217
218 PUBLIC _Mul32x32to64
219_Mul32x32to64 proc near
220 push ebp
221 mov ebp, esp
222 push eax
223 push edx
224 push edi
225
226 mov edi, [ebp+8] ;64 bits result
227 mov eax, [ebp+12] ;op1
228 mov edx, [ebp+16] ;op2
229 mul edx
230 mov [edi], eax
231 mov [edi+4], edx
232
233 pop edi
234 pop edx
235 pop eax
236 pop ebp
237 ret
238_Mul32x32to64 endp
239
240CODE32 ENDS
241
242 END
Note: See TracBrowser for help on using the repository browser.