Alexandre Julliard : ntdll: Call NtRaiseException directly from RtlRaiseException on i386.

Alexandre Julliard julliard at winehq.org
Thu Jul 20 16:20:34 CDT 2017


Module: wine
Branch: master
Commit: a75e3f734d32bd98df9017f1a94819d2b6dca85d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a75e3f734d32bd98df9017f1a94819d2b6dca85d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jul 20 13:35:53 2017 +0200

ntdll: Call NtRaiseException directly from RtlRaiseException on i386.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 .../api-ms-win-core-rtlsupport-l1-1-0.spec         |  2 +-
 .../api-ms-win-core-rtlsupport-l1-2-0.spec         |  2 +-
 dlls/kernel32/kernel32.spec                        |  4 +--
 dlls/ntdll/ntdll.spec                              |  2 +-
 dlls/ntdll/signal_i386.c                           | 34 ++++++++++++++++------
 dlls/ntoskrnl.exe/ntoskrnl.exe.spec                |  2 +-
 6 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/dlls/api-ms-win-core-rtlsupport-l1-1-0/api-ms-win-core-rtlsupport-l1-1-0.spec b/dlls/api-ms-win-core-rtlsupport-l1-1-0/api-ms-win-core-rtlsupport-l1-1-0.spec
index d2966f5..2922b1c 100644
--- a/dlls/api-ms-win-core-rtlsupport-l1-1-0/api-ms-win-core-rtlsupport-l1-1-0.spec
+++ b/dlls/api-ms-win-core-rtlsupport-l1-1-0/api-ms-win-core-rtlsupport-l1-1-0.spec
@@ -8,7 +8,7 @@
 @ cdecl -arch=x86_64 RtlInstallFunctionTableCallback(long long long ptr ptr wstr) ntdll.RtlInstallFunctionTableCallback
 @ stdcall -arch=arm,x86_64 RtlLookupFunctionEntry(long ptr ptr) ntdll.RtlLookupFunctionEntry
 @ stdcall RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader
-@ stdcall -register RtlRaiseException(ptr) ntdll.RtlRaiseException
+@ stdcall -norelay RtlRaiseException(ptr) ntdll.RtlRaiseException
 @ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext
 @ stdcall -register RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
 @ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx
diff --git a/dlls/api-ms-win-core-rtlsupport-l1-2-0/api-ms-win-core-rtlsupport-l1-2-0.spec b/dlls/api-ms-win-core-rtlsupport-l1-2-0/api-ms-win-core-rtlsupport-l1-2-0.spec
index 7ef9c6d..68f2e86 100644
--- a/dlls/api-ms-win-core-rtlsupport-l1-2-0/api-ms-win-core-rtlsupport-l1-2-0.spec
+++ b/dlls/api-ms-win-core-rtlsupport-l1-2-0/api-ms-win-core-rtlsupport-l1-2-0.spec
@@ -2,5 +2,5 @@
 @ stdcall RtlCaptureStackBackTrace(long long ptr ptr) ntdll.RtlCaptureStackBackTrace
 @ stdcall RtlCompareMemory(ptr ptr long) ntdll.RtlCompareMemory
 @ stdcall RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader
-@ stdcall -register RtlRaiseException(ptr) ntdll.RtlRaiseException
+@ stdcall -norelay RtlRaiseException(ptr) ntdll.RtlRaiseException
 @ stdcall -register RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 7ba1978..dedbb93 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -1285,7 +1285,7 @@
 @ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error
 @ stdcall ResumeThread(long)
 @ cdecl -arch=arm,x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable
-@ stdcall -register RtlCaptureContext(ptr) ntdll.RtlCaptureContext
+@ stdcall -norelay RtlCaptureContext(ptr) ntdll.RtlCaptureContext
 @ stdcall RtlCaptureStackBackTrace(long long ptr ptr) ntdll.RtlCaptureStackBackTrace
 @ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr long) ntdll.RtlCompareMemory
 @ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr long) ntdll.RtlCopyMemory
@@ -1295,7 +1295,7 @@
 @ stdcall -arch=arm,x86_64 RtlLookupFunctionEntry(long ptr ptr) ntdll.RtlLookupFunctionEntry
 @ stdcall RtlMoveMemory(ptr ptr long) ntdll.RtlMoveMemory
 @ stdcall -arch=x86_64,arm RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader
-@ stdcall -arch=arm -register RtlRaiseException(ptr) ntdll.RtlRaiseException
+@ stdcall -arch=arm -norelay RtlRaiseException(ptr) ntdll.RtlRaiseException
 @ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext
 @ stdcall RtlUnwind(ptr ptr ptr long) ntdll.RtlUnwind
 @ stdcall -arch=x86_64 RtlUnwindEx(long long ptr long ptr) ntdll.RtlUnwindEx
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 9adf1ed..d7fdced 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -824,7 +824,7 @@
 @ stdcall RtlQueryUnbiasedInterruptTime(ptr)
 @ stub RtlQueueApcWow64Thread
 @ stdcall RtlQueueWorkItem(ptr ptr long)
-@ stdcall -register RtlRaiseException(ptr)
+@ stdcall -norelay RtlRaiseException(ptr)
 @ stdcall RtlRaiseStatus(long)
 @ stdcall RtlRandom(ptr)
 @ stub RtlRandomEx
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 2301ba4..184e6da 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2708,15 +2708,31 @@ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL
 /***********************************************************************
  *		RtlRaiseException (NTDLL.@)
  */
-void WINAPI __regs_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
-{
-    NTSTATUS status;
-
-    rec->ExceptionAddress = (void *)context->Eip;
-    status = raise_exception( rec, context, TRUE );
-    if (status != STATUS_SUCCESS) raise_status( status, rec );
-}
-DEFINE_REGS_ENTRYPOINT( RtlRaiseException, 1 )
+__ASM_STDCALL_FUNC( RtlRaiseException, 4,
+                    "leal -0x2cc(%esp),%esp\n\t"  /* sizeof(CONTEXT) */
+                    __ASM_CFI(".cfi_adjust_cfa_offset 0x2cc\n\t")
+                    "pushl %esp\n\t"              /* context */
+                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                    "call " __ASM_NAME("RtlCaptureContext") __ASM_STDCALL(4) "\n\t"
+                    __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
+                    "movl 0x2cc(%esp),%eax\n\t"   /* return address */
+                    "movl 0x2d0(%esp),%ecx\n\t"   /* rec */
+                    "movl %eax,0xb8(%esp)\n\t"    /* context->Eip */
+                    "movl %eax,12(%ecx)\n\t"      /* rec->ExceptionAddress */
+                    "leal 0x2d4(%esp),%eax\n\t"
+                    "movl %eax,0xc4(%esp)\n\t"    /* context->Esp */
+                    "movl %esp,%eax\n\t"
+                    "pushl $1\n\t"
+                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                    "pushl %eax\n\t"
+                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                    "pushl %ecx\n\t"
+                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                    "call " __ASM_NAME("NtRaiseException") __ASM_STDCALL(12) "\n\t"
+                    __ASM_CFI(".cfi_adjust_cfa_offset -12\n\t")
+                    "pushl %eax\n\t"
+                    "call " __ASM_NAME("RtlRaiseStatus") __ASM_STDCALL(4) "\n\t"
+                    "ret $4" )  /* actually never returns */
 
 
 /*************************************************************************
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index ae2f335..1f60f61 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1134,7 +1134,7 @@
 @ stdcall RtlQueryAtomInAtomTable(ptr long ptr ptr ptr ptr) ntdll.RtlQueryAtomInAtomTable
 @ stdcall RtlQueryRegistryValues(long ptr ptr ptr ptr) ntdll.RtlQueryRegistryValues
 @ stdcall RtlQueryTimeZoneInformation(ptr) ntdll.RtlQueryTimeZoneInformation
-@ stdcall -register RtlRaiseException(ptr) ntdll.RtlRaiseException
+@ stdcall -norelay RtlRaiseException(ptr) ntdll.RtlRaiseException
 @ stdcall RtlRandom(ptr) ntdll.RtlRandom
 @ stub RtlRandomEx
 @ stub RtlRealPredecessor




More information about the wine-cvs mailing list