ntdll: Fix stack alignment in RtlRaiseException assembly code.
Sebastian Lackner
sebastian at fds-team.de
Fri Jul 21 07:51:15 CDT 2017
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
Please review carefully, don't want to break anything shortly before the
release. ;)
dlls/ntdll/signal_i386.c | 41 ++++++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 184e6dafb1a..94595db0c68 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2709,29 +2709,36 @@ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL
* RtlRaiseException (NTDLL.@)
*/
__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")
+ "subl $0x2dc,%esp\n\t" /* sizeof(CONTEXT) + 16 */
+ __ASM_CFI(".cfi_adjust_cfa_offset 0x2dc\n\t")
+ "movl %eax,4(%esp)\n\t"
+ "leal 16(%esp),%eax\n\t" /* context */
+ "movl %eax,(%esp)\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"
+ "subl $4,%esp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+ "leal 16(%esp),%edx\n\t" /* context pointer */
+ "leal 0x2e4(%esp),%eax\n\t" /* orig stack pointer */
+ "movl %eax,0xc4(%edx)\n\t" /* context->Esp */
+ "movl 4(%esp),%eax\n\t" /* original Eax */
+ "movl %eax,0xb0(%edx)\n\t" /* context->Eax */
+ "movl 0x2dc(%esp),%eax\n\t" /* return address */
+ "movl %eax,0xb8(%edx)\n\t" /* context->Eip */
+ "movl 0x2e0(%esp),%ecx\n\t" /* rec */
+ "movl %eax,12(%ecx)\n\t" /* rec->ExceptionAddress */
+ "movl %ecx,(%esp)\n\t"
+ "movl %edx,4(%esp)\n\t"
+ "movl $1,8(%esp)\n\t"
"call " __ASM_NAME("NtRaiseException") __ASM_STDCALL(12) "\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -12\n\t")
- "pushl %eax\n\t"
+ "subl $12,%esp\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset 12\n\t")
+ "movl %eax,(%esp)\n\t"
"call " __ASM_NAME("RtlRaiseStatus") __ASM_STDCALL(4) "\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
+ "addl $0x2d8,%esp\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset -0x2d8\n\t")
"ret $4" ) /* actually never returns */
--
2.13.1
More information about the wine-patches
mailing list