Commit 7aee9076 authored by Alexandre Julliard's avatar Alexandre Julliard

Merged wine_call_to_16_long and wine_call_to_16_short into a single

function.
parent 9534d4f0
...@@ -1026,8 +1026,7 @@ init MAIN_KernelInit ...@@ -1026,8 +1026,7 @@ init MAIN_KernelInit
@ varargs __wine_call_from_16_word() __wine_call_from_16_word @ varargs __wine_call_from_16_word() __wine_call_from_16_word
@ varargs __wine_call_from_16_long() __wine_call_from_16_long @ varargs __wine_call_from_16_long() __wine_call_from_16_long
@ varargs __wine_call_from_16_regs() __wine_call_from_16_regs @ varargs __wine_call_from_16_regs() __wine_call_from_16_regs
@ stdcall wine_call_to_16_word(ptr long) wine_call_to_16_word @ stdcall wine_call_to_16(ptr long) wine_call_to_16
@ stdcall wine_call_to_16_long(ptr long) wine_call_to_16_long
@ stdcall wine_call_to_16_regs_short(ptr long) wine_call_to_16_regs_short @ stdcall wine_call_to_16_regs_short(ptr long) wine_call_to_16_regs_short
@ stdcall wine_call_to_16_regs_long (ptr long) wine_call_to_16_regs_long @ stdcall wine_call_to_16_regs_long (ptr long) wine_call_to_16_regs_long
......
...@@ -285,7 +285,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, ...@@ -285,7 +285,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
* stack pointer is always reset to the position it had before. * stack pointer is always reset to the position it had before.
*/ */
ret = wine_call_to_16_long( (FARPROC16)vpfn16, cbArgs ); ret = wine_call_to_16( (FARPROC16)vpfn16, cbArgs );
if ( pdwRetCode ) if ( pdwRetCode )
*pdwRetCode = ret; *pdwRetCode = ret;
......
...@@ -80,17 +80,9 @@ BOOL RELAY_Init(void) ...@@ -80,17 +80,9 @@ BOOL RELAY_Init(void)
*/ */
#ifndef __i386__ #ifndef __i386__
/*********************************************************************** /***********************************************************************
* wine_call_to_16_word (KERNEL32.@) * wine_call_to_16 (KERNEL32.@)
*/ */
WORD WINAPI wine_call_to_16_word( FARPROC16 target, INT nArgs ) LONG WINAPI wine_call_to_16( FARPROC16 target, INT nArgs )
{
assert( FALSE );
}
/***********************************************************************
* wine_call_to_16_long (KERNEL32.@)
*/
LONG WINAPI wine_call_to_16_long( FARPROC16 target, INT nArgs )
{ {
assert( FALSE ); assert( FALSE );
} }
......
...@@ -380,8 +380,7 @@ BOOL16 WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCST ...@@ -380,8 +380,7 @@ BOOL16 WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCST
BOOL16 WINAPI WriteProfileSection16(LPCSTR,LPCSTR); BOOL16 WINAPI WriteProfileSection16(LPCSTR,LPCSTR);
/* Wine-specific functions */ /* Wine-specific functions */
WORD WINAPI wine_call_to_16_word( FARPROC16 target, INT nArgs ); LONG WINAPI wine_call_to_16( FARPROC16 target, INT nArgs );
LONG WINAPI wine_call_to_16_long( FARPROC16 target, INT nArgs );
void WINAPI wine_call_to_16_regs_short( CONTEXT86 *context, INT nArgs ); void WINAPI wine_call_to_16_regs_short( CONTEXT86 *context, INT nArgs );
void WINAPI wine_call_to_16_regs_long ( CONTEXT86 *context, INT nArgs ); void WINAPI wine_call_to_16_regs_long ( CONTEXT86 *context, INT nArgs );
......
...@@ -337,7 +337,7 @@ static DWORD CALLBACK THREAD_StartThread16( LPVOID threadArgs ) ...@@ -337,7 +337,7 @@ static DWORD CALLBACK THREAD_StartThread16( LPVOID threadArgs )
HeapFree( GetProcessHeap(), 0, threadArgs ); HeapFree( GetProcessHeap(), 0, threadArgs );
((LPDWORD)CURRENT_STACK16)[-1] = param; ((LPDWORD)CURRENT_STACK16)[-1] = param;
return wine_call_to_16_long( start, sizeof(DWORD) ); return wine_call_to_16( start, sizeof(DWORD) );
} }
HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack, HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
FARPROC16 start, SEGPTR param, FARPROC16 start, SEGPTR param,
......
...@@ -447,8 +447,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho ...@@ -447,8 +447,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
* *
* This routine builds the core routines used in 32->16 thunks: * This routine builds the core routines used in 32->16 thunks:
* *
* extern void WINAPI wine_call_to_16_word( SEGPTR target, int nb_args ); * extern LONG WINAPI wine_call_to_16( SEGPTR target, int nb_args );
* extern void WINAPI wine_call_to_16_long( SEGPTR target, int nb_args );
* extern void WINAPI wine_call_to_16_regs_short( const CONTEXT86 *context, int nb_args ); * extern void WINAPI wine_call_to_16_regs_short( const CONTEXT86 *context, int nb_args );
* extern void WINAPI wine_call_to_16_regs_long ( const CONTEXT86 *context, int nb_args ); * extern void WINAPI wine_call_to_16_regs_long ( const CONTEXT86 *context, int nb_args );
* *
...@@ -469,17 +468,14 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho ...@@ -469,17 +468,14 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
* core routine. * core routine.
* *
*/ */
static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func ) static void BuildCallTo16Core( FILE *outfile, int reg_func )
{ {
char *name = reg_func == 2 ? "regs_long" : const char *name = reg_func == 2 ? "wine_call_to_16_regs_long" :
reg_func == 1 ? "regs_short" : reg_func == 1 ? "wine_call_to_16_regs_short" :
short_ret? "word" : "long"; "wine_call_to_16";
/* Function header */ /* Function header */
if (reg_func == 2) function_header( outfile, "wine_call_to_16_regs_long" ); function_header( outfile, name );
else if (reg_func == 1) function_header( outfile, "wine_call_to_16_regs_short" );
else if (short_ret) function_header( outfile, "wine_call_to_16_word" );
else function_header( outfile, "wine_call_to_16_long" );
/* Function entry sequence */ /* Function entry sequence */
fprintf( outfile, "\tpushl %%ebp\n" ); fprintf( outfile, "\tpushl %%ebp\n" );
...@@ -495,10 +491,10 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func ) ...@@ -495,10 +491,10 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
if ( UsePIC ) if ( UsePIC )
{ {
/* Get Global Offset Table into %ebx */ /* Get Global Offset Table into %ebx */
fprintf( outfile, "\tcall .Lwine_call_to_16_%s.getgot1\n", name ); fprintf( outfile, "\tcall .L%s.getgot1\n", name );
fprintf( outfile, ".Lwine_call_to_16_%s.getgot1:\n", name ); fprintf( outfile, ".L%s.getgot1:\n", name );
fprintf( outfile, "\tpopl %%ebx\n" ); fprintf( outfile, "\tpopl %%ebx\n" );
fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.Lwine_call_to_16_%s.getgot1], %%ebx\n", name ); fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.L%s.getgot1], %%ebx\n", name );
} }
/* Print debugging info */ /* Print debugging info */
...@@ -543,7 +539,7 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func ) ...@@ -543,7 +539,7 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
/* Call the actual CallTo16 routine (simulate a lcall) */ /* Call the actual CallTo16 routine (simulate a lcall) */
fprintf( outfile, "\tpushl %%cs\n" ); fprintf( outfile, "\tpushl %%cs\n" );
fprintf( outfile, "\tcall .Lwine_call_to_16_%s\n", reg_func ? name : "long" ); fprintf( outfile, "\tcall .L%s\n", name );
/* Remove exception frame */ /* Remove exception frame */
fprintf( outfile, "\t.byte 0x64\n\tpopl (%d)\n", STRUCTOFFSET(TEB,except) ); fprintf( outfile, "\t.byte 0x64\n\tpopl (%d)\n", STRUCTOFFSET(TEB,except) );
...@@ -553,17 +549,9 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func ) ...@@ -553,17 +549,9 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
if ( !reg_func ) if ( !reg_func )
{ {
/* Convert and push return value */ /* Convert and push return value */
if ( short_ret ) fprintf( outfile, "\tshll $16,%%edx\n" );
{ fprintf( outfile, "\tmovw %%ax,%%dx\n" );
fprintf( outfile, "\tmovzwl %%ax, %%eax\n" ); fprintf( outfile, "\tpushl %%edx\n" );
fprintf( outfile, "\tpushl %%eax\n" );
}
else
{
fprintf( outfile, "\tshll $16,%%edx\n" );
fprintf( outfile, "\tmovw %%ax,%%dx\n" );
fprintf( outfile, "\tpushl %%edx\n" );
}
} }
else else
{ {
...@@ -594,10 +582,10 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func ) ...@@ -594,10 +582,10 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
if ( UsePIC ) if ( UsePIC )
{ {
/* Get Global Offset Table into %ebx (might have been overwritten) */ /* Get Global Offset Table into %ebx (might have been overwritten) */
fprintf( outfile, "\tcall .Lwine_call_to_16_%s.getgot2\n", name ); fprintf( outfile, "\tcall .L%s.getgot2\n", name );
fprintf( outfile, ".Lwine_call_to_16_%s.getgot2:\n", name ); fprintf( outfile, ".L%s.getgot2:\n", name );
fprintf( outfile, "\tpopl %%ebx\n" ); fprintf( outfile, "\tpopl %%ebx\n" );
fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.Lwine_call_to_16_%s.getgot2], %%ebx\n", name ); fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.L%s.getgot2], %%ebx\n", name );
} }
/* Leave Win16 Mutex */ /* Leave Win16 Mutex */
...@@ -636,9 +624,7 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func ) ...@@ -636,9 +624,7 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
/* Start of the actual CallTo16 routine */ /* Start of the actual CallTo16 routine */
if (!reg_func && short_ret) return; /* call_to_16_word uses call_to_16_long backend routine */ fprintf( outfile, ".L%s:\n", name );
fprintf( outfile, ".Lwine_call_to_16_%s:\n", name );
/* Switch to the 16-bit stack */ /* Switch to the 16-bit stack */
fprintf( outfile, "\tmovl %%esp,%%edx\n" ); fprintf( outfile, "\tmovl %%esp,%%edx\n" );
...@@ -1200,17 +1186,14 @@ void BuildRelays16( FILE *outfile ) ...@@ -1200,17 +1186,14 @@ void BuildRelays16( FILE *outfile )
/* C16ThkSL CallFrom16 routine */ /* C16ThkSL CallFrom16 routine */
BuildCallFrom16Core( outfile, FALSE, TRUE, FALSE ); BuildCallFrom16Core( outfile, FALSE, TRUE, FALSE );
/* Standard CallTo16 routine (WORD return) */ /* Standard CallTo16 routine */
BuildCallTo16Core( outfile, TRUE, FALSE ); BuildCallTo16Core( outfile, 0 );
/* Standard CallTo16 routine (DWORD return) */
BuildCallTo16Core( outfile, FALSE, FALSE );
/* Register CallTo16 routine (16:16 retf) */ /* Register CallTo16 routine (16:16 retf) */
BuildCallTo16Core( outfile, FALSE, 1 ); BuildCallTo16Core( outfile, 1 );
/* Register CallTo16 routine (16:32 retf) */ /* Register CallTo16 routine (16:32 retf) */
BuildCallTo16Core( outfile, FALSE, 2 ); BuildCallTo16Core( outfile, 2 );
/* CBClientThunkSL routine */ /* CBClientThunkSL routine */
BuildCallTo32CBClient( outfile, FALSE ); BuildCallTo32CBClient( outfile, FALSE );
......
...@@ -505,8 +505,7 @@ static void BuildCallTo16Func( FILE *outfile, const char *profile, const char *p ...@@ -505,8 +505,7 @@ static void BuildCallTo16Func( FILE *outfile, const char *profile, const char *p
fprintf( outfile, " *)args = arg%d;\n", i+1 ); fprintf( outfile, " *)args = arg%d;\n", i+1 );
} }
fprintf( outfile, " return wine_call_to_16_%s( proc, %d );\n}\n\n", fprintf( outfile, " return wine_call_to_16( proc, %d );\n}\n\n", argsize );
short_ret? "word" : "long", argsize );
#else /* __i386__ */ #else /* __i386__ */
fprintf( outfile, " assert(0);\n}\n\n" ); fprintf( outfile, " assert(0);\n}\n\n" );
#endif /* __i386__ */ #endif /* __i386__ */
...@@ -914,8 +913,7 @@ void BuildGlue( FILE *outfile, const char *srcdir, char **argv ) ...@@ -914,8 +913,7 @@ void BuildGlue( FILE *outfile, const char *srcdir, char **argv )
output_file_header( outfile ); output_file_header( outfile );
#ifdef __i386__ #ifdef __i386__
fprintf( outfile, "extern unsigned short __stdcall wine_call_to_16_word( void (*target)(), int args );\n" ); fprintf( outfile, "extern unsigned int __stdcall wine_call_to_16( void (*target)(), int args );\n\n" );
fprintf( outfile, "extern unsigned int __stdcall wine_call_to_16_long( void (*target)(), int args );\n\n" );
#else #else
fprintf( outfile, "#include <assert.h>\n\n" ); fprintf( outfile, "#include <assert.h>\n\n" );
#endif #endif
......
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