Commit e56d9dea authored by Alexandre Julliard's avatar Alexandre Julliard

Added vararg argument type so that the relay code can distinguish from

a normal cdecl function. Don't rely on the relay thunk preserving the stack pointer.
parent 1943208e
...@@ -334,6 +334,9 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) ...@@ -334,6 +334,9 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
debugstr_a( MapSL(*(SEGPTR *)args16 )) ); debugstr_a( MapSL(*(SEGPTR *)args16 )) );
args16 += sizeof(SEGPTR); args16 += sizeof(SEGPTR);
break; break;
case ARG_VARARG:
DPRINTF( "..." );
break;
default: default:
break; break;
} }
...@@ -374,6 +377,9 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) ...@@ -374,6 +377,9 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16, DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )) ); debugstr_a( MapSL(*(SEGPTR *)args16 )) );
break; break;
case ARG_VARARG:
DPRINTF( "..." );
break;
default: default:
break; break;
} }
......
...@@ -213,7 +213,8 @@ enum arg_types ...@@ -213,7 +213,8 @@ enum arg_types
ARG_LONG, /* long or segmented pointer */ ARG_LONG, /* long or segmented pointer */
ARG_PTR, /* linear pointer */ ARG_PTR, /* linear pointer */
ARG_STR, /* linear pointer to null-terminated string */ ARG_STR, /* linear pointer to null-terminated string */
ARG_SEGSTR /* segmented pointer to null-terminated string */ ARG_SEGSTR, /* segmented pointer to null-terminated string */
ARG_VARARG /* start of varargs */
}; };
/* flags added to arg_types[0] */ /* flags added to arg_types[0] */
......
...@@ -369,7 +369,8 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho ...@@ -369,7 +369,8 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
if ( reg_func ) if ( reg_func )
{ {
fprintf( outfile, "\tmovl %%esp, %%ebx\n" ); fprintf( outfile, "\tleal -%d(%%ebp), %%ebx\n",
sizeof(CONTEXT) + STRUCTOFFSET(STACK32FRAME, ebp) );
/* Switch stack back */ /* Switch stack back */
fprintf( outfile, "\t.byte 0x64\n\tmovw (%d), %%ss\n", STACKOFFSET+2 ); fprintf( outfile, "\t.byte 0x64\n\tmovw (%d), %%ss\n", STACKOFFSET+2 );
......
...@@ -254,7 +254,7 @@ static void BuildCallFrom16Func( FILE *outfile, const char *profile, const char ...@@ -254,7 +254,7 @@ static void BuildCallFrom16Func( FILE *outfile, const char *profile, const char
fprintf( outfile, "void" ); fprintf( outfile, "void" );
fprintf( outfile, " );\n" ); fprintf( outfile, " );\n" );
fprintf( outfile, "static %s __stdcall __wine_%s_CallFrom16_%s( proc_%s_t proc, unsigned char *args%s )\n", fprintf( outfile, "static %s __wine_%s_CallFrom16_%s( proc_%s_t proc, unsigned char *args%s )\n",
ret_type, make_c_identifier(prefix), profile, profile, ret_type, make_c_identifier(prefix), profile, profile,
reg_func? ", void *context" : "" ); reg_func? ", void *context" : "" );
...@@ -781,6 +781,7 @@ void BuildSpec16File( FILE *outfile, DLLSPEC *spec ) ...@@ -781,6 +781,7 @@ void BuildSpec16File( FILE *outfile, DLLSPEC *spec )
} }
arg_types[j / 10] |= type << (3 * (j % 10)); arg_types[j / 10] |= type << (3 * (j % 10));
} }
if (typelist[i]->type == TYPE_VARARGS) arg_types[j / 10] |= ARG_VARARG << (3 * (j % 10));
if (typelist[i]->flags & FLAG_REGISTER) arg_types[0] |= ARG_REGISTER; if (typelist[i]->flags & FLAG_REGISTER) arg_types[0] |= ARG_REGISTER;
if (typelist[i]->flags & FLAG_RET16) arg_types[0] |= ARG_RET16; if (typelist[i]->flags & FLAG_RET16) arg_types[0] |= ARG_RET16;
......
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