source: trunk/src/kernel32/except.asm@ 91

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

* empty log message *

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