From deaec125ca4083b5808ae48a6a368bd880e9d067 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 1 Jul 2005 19:18:46 +0000 Subject: [PATCH] Don't use the full 32 bits of %esp when called from 16-bit code. --- tools/winebuild/import.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 47885b87961..f186883f7ab 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -705,8 +705,7 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta } else { - if (!strcmp( name, "__wine_call_from_32_regs" ) || - !strcmp( name, "__wine_call_from_16_regs" )) + if (!strcmp( name, "__wine_call_from_32_regs" )) { /* special case: need to preserve all registers */ fprintf( outfile, " \"\\tpushl %%eax\\n\"\n" ); @@ -720,6 +719,23 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta fprintf( outfile, " \"\\txchgl %%eax,(%%esp)\\n\"\n" ); fprintf( outfile, " \"\\tret\\n\"\n" ); } + else if (!strcmp( name, "__wine_call_from_16_regs" )) + { + /* special case: need to preserve all registers */ + fprintf( outfile, " \"\\tpushl %%eax\\n\"\n" ); + fprintf( outfile, " \"\\tpushl %%ecx\\n\"\n" ); + fprintf( outfile, " \"\\tcall .L__wine_spec_%s\\n\"\n", name ); + fprintf( outfile, " \".L__wine_spec_%s:\\n\"\n", name ); + fprintf( outfile, " \"\\tpopl %%eax\\n\"\n" ); + fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" ); + fprintf( outfile, " \"\\tmovl %s+%d-.L__wine_spec_%s(%%eax),%%eax\\n\"\n", + asm_name(table), pos, name ); + fprintf( outfile, " \"\\tmovzwl %%sp, %%ecx\\n\"\n" ); + fprintf( outfile, " \"\\t.byte 0x36\\n\"\n" ); + fprintf( outfile, " \"\\txchgl %%eax,4(%%ecx)\\n\"\n" ); + fprintf( outfile, " \"\\tpopl %%ecx\\n\"\n" ); + fprintf( outfile, " \"\\tret\\n\"\n" ); + } else { fprintf( outfile, " \"\\tcall .L__wine_spec_%s\\n\"\n", name );