Commit 52bce47b authored by Alexandre Julliard's avatar Alexandre Julliard

kernel: Implement FT_Exit directly in assembly to avoid the overhead

of register functions.
parent ca0246fb
......@@ -348,21 +348,21 @@
@ stub ExpungeConsoleCommandHistoryA
@ stub ExpungeConsoleCommandHistoryW
@ stub ExtendVirtualBuffer
@ stdcall -i386 -register FT_Exit0()
@ stdcall -i386 -register FT_Exit12()
@ stdcall -i386 -register FT_Exit16()
@ stdcall -i386 -register FT_Exit20()
@ stdcall -i386 -register FT_Exit24()
@ stdcall -i386 -register FT_Exit28()
@ stdcall -i386 -register FT_Exit32()
@ stdcall -i386 -register FT_Exit36()
@ stdcall -i386 -register FT_Exit40()
@ stdcall -i386 -register FT_Exit44()
@ stdcall -i386 -register FT_Exit48()
@ stdcall -i386 -register FT_Exit4()
@ stdcall -i386 -register FT_Exit52()
@ stdcall -i386 -register FT_Exit56()
@ stdcall -i386 -register FT_Exit8()
@ stdcall -i386 -norelay FT_Exit0()
@ stdcall -i386 -norelay FT_Exit12()
@ stdcall -i386 -norelay FT_Exit16()
@ stdcall -i386 -norelay FT_Exit20()
@ stdcall -i386 -norelay FT_Exit24()
@ stdcall -i386 -norelay FT_Exit28()
@ stdcall -i386 -norelay FT_Exit32()
@ stdcall -i386 -norelay FT_Exit36()
@ stdcall -i386 -norelay FT_Exit40()
@ stdcall -i386 -norelay FT_Exit44()
@ stdcall -i386 -norelay FT_Exit48()
@ stdcall -i386 -norelay FT_Exit4()
@ stdcall -i386 -norelay FT_Exit52()
@ stdcall -i386 -norelay FT_Exit56()
@ stdcall -i386 -norelay FT_Exit8()
@ stdcall -i386 -register FT_Prolog()
@ stdcall -i386 -register FT_Thunk()
@ stdcall FatalAppExitA(long str)
......
......@@ -626,6 +626,8 @@ void WINAPI __regs_FT_Thunk( CONTEXT86 *context )
DEFINE_REGS_ENTRYPOINT( FT_Thunk, 0, 0 );
#endif
#ifdef __i386__
/***********************************************************************
* FT_Exit0 (KERNEL32.@)
* FT_Exit4 (KERNEL32.@)
......@@ -651,33 +653,15 @@ DEFINE_REGS_ENTRYPOINT( FT_Thunk, 0, 0 );
* and perform a return to the CALLER of the thunk code (while removing
* the given number of arguments from the caller's stack).
*/
static inline void FT_Exit(CONTEXT86 *context)
{
/* Return value is in EBX */
context->Eax = context->Ebx;
/* Restore EBX, ESI, and EDI registers */
context->Ebx = *(DWORD *)(context->Ebp - 4);
context->Esi = *(DWORD *)(context->Ebp - 8);
context->Edi = *(DWORD *)(context->Ebp - 12);
/* Clean up stack frame */
context->Esp = context->Ebp;
context->Ebp = stack32_pop(context);
/* Pop return address to CALLER of thunk code */
context->Eip = stack32_pop(context);
}
#ifdef DEFINE_REGS_ENTRYPOINT
#define FT_EXIT_RESTORE_REGS \
"movl %ebx,%eax\n\t" \
"movl -4(%ebp),%ebx\n\t" \
"movl -8(%ebp),%esi\n\t" \
"movl -12(%ebp),%edi\n\t" \
"leave\n\t"
#define DEFINE_FT_Exit(n) \
void WINAPI __regs_FT_Exit ## n(CONTEXT86 *context) \
{ \
FT_Exit(context); \
context->Esp += n; \
} \
DEFINE_REGS_ENTRYPOINT( FT_Exit ## n, 0, 0 )
__ASM_GLOBAL_FUNC( FT_Exit ## n, FT_EXIT_RESTORE_REGS "ret $" #n );
DEFINE_FT_Exit(0);
DEFINE_FT_Exit(4);
......@@ -695,7 +679,7 @@ DEFINE_FT_Exit(48);
DEFINE_FT_Exit(52);
DEFINE_FT_Exit(56);
#endif /* DEFINE_REGS_ENTRYPOINT */
#endif /* __i386__ */
/***********************************************************************
......
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