From a75e3f734d32bd98df9017f1a94819d2b6dca85d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 20 Jul 2017 13:35:53 +0200 Subject: [PATCH] ntdll: Call NtRaiseException directly from RtlRaiseException on i386. Signed-off-by: Alexandre Julliard --- .../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 d2966f52e08..2922b1c1427 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 7ef9c6dafbf..68f2e86b08b 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 7ba1978f5a3..dedbb938718 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 9adf1edd4a5..d7fdced48ce 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 2301ba4c3c8..184e6dafb1a 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 ae2f33584ef..1f60f61fa50 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 -- 2.11.4.GIT