ntdll: Don't reset rsp to context->Rsp until exception data is copied.

Context record may be stored on stack below context stack. This
happens, e. g., with RtlRaiseException().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-07-02 11:06:04 +03:00 committed by Alexandre Julliard
parent 877540b522
commit 69b6572338
1 changed files with 6 additions and 5 deletions

View File

@ -1979,17 +1979,18 @@ __ASM_GLOBAL_FUNC( user_exception_dispatcher_trampoline,
void WINAPI do_call_user_exception_dispatcher(EXCEPTION_RECORD *rec, CONTEXT *context, struct stack_layout *stack)
{
memcpy(&stack->context, context, sizeof(*context));
memmove(&stack->context, context, sizeof(*context));
memcpy(&stack->rec, rec, sizeof(*rec));
user_exception_dispatcher_trampoline( stack, pKiUserExceptionDispatcher );
}
__ASM_GLOBAL_FUNC( call_user_exception_dispatcher,
"movq 0x98(%rdx),%rsp\n\t" /* context->Rsp */
"and $~0xf,%rsp\n\t"
"sub $0x630,%rsp\n\t" /* sizeof(struct stack_layout) */
"movq %rsp,%r8\n\t"
"movq 0x98(%rdx),%r8\n\t" /* context->Rsp */
"andq $~0xf,%r8\n\t"
"subq $0x630,%r8\n\t" /* sizeof(struct stack_layout) */
"cmpq %r8,%rsp\n\t"
"cmovbq %r8,%rsp\n\t"
"jmp " __ASM_NAME("do_call_user_exception_dispatcher") "\n\t")
/***********************************************************************