Module: wine Branch: master Commit: 43682ce114ff5499e9e89e396a0fb66eb97f3dbc URL: http://source.winehq.org/git/wine.git/?a=commit;h=43682ce114ff5499e9e89e396a...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 1 12:13:19 2011 +0100
ntdll: Avoid copying and restoring the context in RtlCaptureContext for i386.
---
dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/signal_i386.c | 35 ++++++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index da674cd..0976bc5 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -435,7 +435,7 @@ # @ stub RtlAssert2 @ stdcall RtlAssert(ptr ptr long long) # @ stub RtlCancelTimer -@ stdcall -register RtlCaptureContext(ptr) +@ stdcall -norelay RtlCaptureContext(ptr) @ stdcall RtlCaptureStackBackTrace(long long ptr ptr) # @ stub RtlCaptureStackContext @ stdcall RtlCharToInteger(ptr long ptr) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index f86c810..69c9c3f 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1151,13 +1151,34 @@ static inline void restore_context( const CONTEXT *context, SIGCONTEXT *sigconte /*********************************************************************** * RtlCaptureContext (NTDLL.@) */ -void WINAPI __regs_RtlCaptureContext( CONTEXT *context, CONTEXT *regs ) -{ - *context = *regs; - if (fpux_support) save_fpux( context ); - else save_fpu( context ); -} -DEFINE_REGS_ENTRYPOINT( RtlCaptureContext, 1 ) +__ASM_STDCALL_FUNC( RtlCaptureContext, 4, + "pushl %eax\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + "movl 8(%esp),%eax\n\t" /* context */ + "movl $0x10007,(%eax)\n\t" /* context->ContextFlags */ + "movw %gs,0x8c(%eax)\n\t" /* context->SegGs */ + "movw %fs,0x90(%eax)\n\t" /* context->SegFs */ + "movw %es,0x94(%eax)\n\t" /* context->SegEs */ + "movw %ds,0x98(%eax)\n\t" /* context->SegDs */ + "movl %edi,0x9c(%eax)\n\t" /* context->Edi */ + "movl %esi,0xa0(%eax)\n\t" /* context->Esi */ + "movl %ebx,0xa4(%eax)\n\t" /* context->Ebx */ + "movl %edx,0xa8(%eax)\n\t" /* context->Edx */ + "movl %ecx,0xac(%eax)\n\t" /* context->Ecx */ + "movl %ebp,0xb4(%eax)\n\t" /* context->Ebp */ + "movl 4(%esp),%edx\n\t" + "movl %edx,0xb8(%eax)\n\t" /* context->Eip */ + "movw %cs,0xbc(%eax)\n\t" /* context->SegCs */ + "pushfl\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + "popl 0xc0(%eax)\n\t" /* context->EFlags */ + __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") + "leal 8(%esp),%edx\n\t" + "movl %edx,0xc4(%eax)\n\t" /* context->Esp */ + "movw %ss,0xc8(%eax)\n\t" /* context->SegSs */ + "popl 0xb0(%eax)\n\t" /* context->Eax */ + __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") + "ret $4" )
/***********************************************************************