Commit ed6aa17d authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Simplify stack layout in __crtCapturePreviousContext().

parent 451c8592
......@@ -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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment