Module: wine Branch: master Commit: ed6aa17d9880f5c5e1fe47fe725bfe96d4ed681f URL: https://source.winehq.org/git/wine.git/?a=commit;h=ed6aa17d9880f5c5e1fe47fe7...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Aug 21 13:54:46 2019 +0200
msvcrt: Simplify stack layout in __crtCapturePreviousContext().
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/except_x86_64.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/dlls/msvcrt/except_x86_64.c b/dlls/msvcrt/except_x86_64.c index 1aa04ab..09eddfb 100644 --- a/dlls/msvcrt/except_x86_64.c +++ b/dlls/msvcrt/except_x86_64.c @@ -732,9 +732,6 @@ void __cdecl get_prev_context(CONTEXT *ctx, DWORD64 rip)
TRACE("(%p)\n", ctx);
- ctx->Rip = rip; - ctx->Rsp += 3*8; /* Rip, Rcx, return address */ - rf = RtlLookupFunctionEntry(ctx->Rip, &image_base, NULL); if(!rf) { FIXME("RtlLookupFunctionEntry failed\n"); @@ -746,16 +743,14 @@ void __cdecl get_prev_context(CONTEXT *ctx, DWORD64 rip) }
__ASM_GLOBAL_FUNC( __crtCapturePreviousContext, - "pushq (%rsp)\n\t" /* save Rip */ - __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") - "pushq %rcx\n\t" - __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") - "call " __ASM_NAME("RtlCaptureContext") "\n\t" - "popq %rcx\n\t" - __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") - "popq %rdx\n\t" - __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") - "jmp " __ASM_NAME("get_prev_context") ); + "movq %rcx,8(%rsp)\n\t" + "call " __ASM_NAME("RtlCaptureContext") "\n\t" + "movq 8(%rsp),%rcx\n\t" /* context */ + "leaq 8(%rsp),%rax\n\t" + "movq %rax,0x98(%rcx)\n\t" /* context->Rsp */ + "movq (%rsp),%rax\n\t" + "movq %rax,0xf8(%rcx)\n\t" /* context->Rip */ + "jmp " __ASM_NAME("get_prev_context") ) #endif
#endif /* __x86_64__ */