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