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.
This commit is contained in:
Alexandre Julliard 2005-07-05 11:50:40 +00:00
parent 1943208eec
commit e56d9deac4
4 changed files with 12 additions and 3 deletions

View File

@ -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 )
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;
} }

View File

@ -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] */

View File

@ -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 );

View File

@ -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 )
} }
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;