Skip to content

Commit 9a940ae

Browse files
committed
[MSVCRT] Use __wine_RtlUnwind
1 parent e7823ed commit 9a940ae

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* PROJECT: ReactOS msvcrt.dll
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: x86 asm implementation of __wine__RtlUnwind
5+
* COPYRIGHT: Copyright Timo Kreuzer <timo.kreuzer@reactos.org>
6+
*/
7+
8+
#include <asm.inc>
9+
10+
.code
11+
12+
EXTERN _RtlUnwind@16:PROC
13+
14+
// ASM wrapper for Wine code. This is needed, because Wine code expects
15+
// RtlUnwind to restore the non-volatile registers, before returning, but
16+
// ours / the native one does not do that.
17+
//
18+
// void
19+
// WINAPI
20+
// __wine__RtlUnwind(
21+
// PVOID TargetFrame,
22+
// PVOID TargetIp ,
23+
// PEXCEPTION_RECORD ExceptionRecord ,
24+
// PVOID ReturnValue);
25+
//
26+
PUBLIC ___wine_RtlUnwind@16
27+
___wine_RtlUnwind@16:
28+
29+
push ebp
30+
mov ebp, esp
31+
32+
/* Save non-volatile registers */
33+
push ebx
34+
push esi
35+
push edi
36+
37+
/* Call the native function */
38+
push dword ptr [ebp + 20] // ReturnValue
39+
push dword ptr [ebp + 16] // ExceptionRecord
40+
push dword ptr [ebp + 12] // TargetIp
41+
push dword ptr [ebp + 8] // TargetFrame
42+
call _RtlUnwind@16
43+
44+
/* Restore non-volatile registers */
45+
pop edi
46+
pop esi
47+
pop ebx
48+
49+
mov esp, ebp
50+
pop ebp
51+
ret 16
52+
53+
END

0 commit comments

Comments
 (0)