From: Zebediah Figura zfigura@codeweavers.com
We always compile i386 code without PIC in Wine, and I do not see a reason to support non-PIC 16-bit modules for winelib. --- tools/winebuild/relay.c | 21 +++------------------ tools/winebuild/spec16.c | 9 +-------- 2 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index b86a88aae24..31a8be976c0 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -130,34 +130,19 @@ static void BuildCallFrom16Core( int reg_func, int thunk ) /* Save original EFlags register */ if (reg_func) output( "\tpushfl\n" );
- if ( UsePIC ) - { - output( "\tcall 1f\n" ); - output( "1:\tpopl %%ecx\n" ); - output( "\t.byte 0x2e\n\tmovl %s-1b(%%ecx),%%edx\n", asm_name("CallTo16_DataSelector") ); - } - else - output( "\t.byte 0x2e\n\tmovl %s,%%edx\n", asm_name("CallTo16_DataSelector") );
/* Load 32-bit segment registers */ + output( "\t.byte 0x2e\n\tmovl %s,%%edx\n", asm_name("CallTo16_DataSelector") ); output( "\tmovw %%dx, %%ds\n" ); output( "\tmovw %%dx, %%es\n" ); - - if ( UsePIC ) - output( "\tmovw %s-1b(%%ecx), %%fs\n", asm_name("CallTo16_TebSelector") ); - else - output( "\tmovw %s, %%fs\n", asm_name("CallTo16_TebSelector") ); - + output( "\tmovw %s, %%fs\n", asm_name("CallTo16_TebSelector") ); output( "\t.byte 0x64\n\tmov (%d),%%gs\n", GS_OFFSET );
/* Translate STACK16FRAME base to flat offset in %edx */ output( "\tmovw %%ss, %%dx\n" ); output( "\tandl $0xfff8, %%edx\n" ); output( "\tshrl $1, %%edx\n" ); - if (UsePIC) - output( "\taddl .Lwine_ldt_copy_ptr-1b(%%ecx),%%edx\n" ); - else - output( "\taddl .Lwine_ldt_copy_ptr,%%edx\n" ); + output( "\taddl .Lwine_ldt_copy_ptr,%%edx\n" ); output( "\tmovl (%%edx), %%edx\n" ); output( "\tmovzwl %%sp, %%ebp\n" ); output( "\tleal %d(%%ebp,%%edx), %%edx\n", reg_func ? 0 : -4 ); diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index 8d4f96ea323..97567bab4c1 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -353,14 +353,7 @@ static void output_call16_function( ORDDEF *odp ) output( "\tpushl %%esi\n" ); output_cfi( ".cfi_rel_offset %%esi,-4" ); stack_words++; - if (UsePIC) - { - output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") ); - output( "1:\tmovl .Lwine_ldt_copy_ptr-1b(%%eax),%%esi\n" ); - needs_get_pc_thunk = 1; - } - else - output( "\tmovl .Lwine_ldt_copy_ptr,%%esi\n" ); + output( "\tmovl .Lwine_ldt_copy_ptr,%%esi\n" ); }
/* preserve 16-byte stack alignment */
From: Zebediah Figura zfigura@codeweavers.com
Presumably at one point there were assemblers that choked on these. However, currently we use segment prefixes elsewhere in wine (namely, in the syscall dispatcher), and it seems fair to assume that a sane compiler should support them. --- tools/winebuild/relay.c | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index 31a8be976c0..1b01d49d4b5 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -132,11 +132,11 @@ static void BuildCallFrom16Core( int reg_func, int thunk )
/* Load 32-bit segment registers */ - output( "\t.byte 0x2e\n\tmovl %s,%%edx\n", asm_name("CallTo16_DataSelector") ); + output( "\tmovl %%cs:%s,%%edx\n", asm_name("CallTo16_DataSelector") ); output( "\tmovw %%dx, %%ds\n" ); output( "\tmovw %%dx, %%es\n" ); output( "\tmovw %s, %%fs\n", asm_name("CallTo16_TebSelector") ); - output( "\t.byte 0x64\n\tmov (%d),%%gs\n", GS_OFFSET ); + output( "\tmov %%fs:(%d),%%gs\n", GS_OFFSET );
/* Translate STACK16FRAME base to flat offset in %edx */ output( "\tmovw %%ss, %%dx\n" ); @@ -151,12 +151,12 @@ static void BuildCallFrom16Core( int reg_func, int thunk ) if (reg_func) output( "\tpopl %%ecx\n" );
/* Get the 32-bit stack pointer from the TEB and complete STACK16FRAME */ - output( "\t.byte 0x64\n\tmovl (%d), %%ebp\n", STACKOFFSET ); + output( "\tmovl %%fs:(%d), %%ebp\n", STACKOFFSET ); output( "\tpushl %%ebp\n" );
/* Switch stacks */ - output( "\t.byte 0x64\n\tmovw %%ss, (%d)\n", STACKOFFSET + 2 ); - output( "\t.byte 0x64\n\tmovw %%sp, (%d)\n", STACKOFFSET ); + output( "\tmovw %%ss, %%fs:(%d)\n", STACKOFFSET + 2 ); + output( "\tmovw %%sp, %%fs:(%d)\n", STACKOFFSET ); output( "\tpushl %%ds\n" ); output( "\tpopl %%ss\n" ); output( "\tmovl %%ebp, %%esp\n" ); @@ -242,9 +242,9 @@ static void BuildCallFrom16Core( int reg_func, int thunk ) output( "\tmovzwl 0x2c(%%edx),%%eax\n"); /* FIELD_OFFSET(STACK16FRAME,ip) */ output( "\tmovl %%eax,0xb8(%%esp)\n" ); /* Eip */
- output( "\t.byte 0x64\n\tmovzwl (%d), %%eax\n", STACKOFFSET+2 ); + output( "\tmovzwl %%fs:(%d), %%eax\n", STACKOFFSET+2 ); output( "\tmovl %%eax,0xc8(%%esp)\n" ); /* SegSs */ - output( "\t.byte 0x64\n\tmovzwl (%d), %%eax\n", STACKOFFSET ); + output( "\tmovzwl %%fs:(%d), %%eax\n", STACKOFFSET ); output( "\taddl $0x2c,%%eax\n"); /* FIELD_OFFSET(STACK16FRAME,ip) */ output( "\tmovl %%eax,0xc4(%%esp)\n" ); /* Esp */ #if 0 @@ -275,9 +275,9 @@ static void BuildCallFrom16Core( int reg_func, int thunk ) output( "\tleal -748(%%ebp),%%ebx\n" ); /* sizeof(CONTEXT) + FIELD_OFFSET(STACK32FRAME,ebp) */
/* Switch stack back */ - output( "\t.byte 0x64\n\tmovw (%d), %%ss\n", STACKOFFSET+2 ); - output( "\t.byte 0x64\n\tmovzwl (%d), %%esp\n", STACKOFFSET ); - output( "\t.byte 0x64\n\tpopl (%d)\n", STACKOFFSET ); + output( "\tmovw %%fs:(%d), %%ss\n", STACKOFFSET+2 ); + output( "\tmovzwl %%fs:(%d), %%esp\n", STACKOFFSET ); + output( "\tpopl %%fs:(%d)\n", STACKOFFSET );
/* Get return address to CallFrom16 stub */ output( "\taddw $0x14,%%sp\n" ); /* FIELD_OFFSET(STACK16FRAME,callfrom_ip)-4 */ @@ -320,9 +320,9 @@ static void BuildCallFrom16Core( int reg_func, int thunk ) else { /* Switch stack back */ - output( "\t.byte 0x64\n\tmovw (%d), %%ss\n", STACKOFFSET+2 ); - output( "\t.byte 0x64\n\tmovzwl (%d), %%esp\n", STACKOFFSET ); - output( "\t.byte 0x64\n\tpopl (%d)\n", STACKOFFSET ); + output( "\tmovw %%fs:(%d), %%ss\n", STACKOFFSET+2 ); + output( "\tmovzwl %%fs:(%d), %%esp\n", STACKOFFSET ); + output( "\tpopl %%fs:(%d)\n", STACKOFFSET );
/* Restore registers */ output( "\tpopl %%edx\n" ); @@ -383,22 +383,22 @@ static void BuildCallTo16Core( int reg_func ) output_cfi( ".cfi_rel_offset %%esi,-8" ); output( "\tpushl %%edi\n" ); output_cfi( ".cfi_rel_offset %%edi,-12" ); - output( "\t.byte 0x64\n\tmov %%gs,(%d)\n", GS_OFFSET ); + output( "\tmov %%gs,%%fs:(%d)\n", GS_OFFSET );
/* Setup exception frame */ - output( "\t.byte 0x64\n\tpushl (%d)\n", STACKOFFSET ); + output( "\tpushl %%fs:(%d)\n", STACKOFFSET ); output( "\tpushl 16(%%ebp)\n" ); /* handler */ - output( "\t.byte 0x64\n\tpushl (0)\n" ); - output( "\t.byte 0x64\n\tmovl %%esp,(0)\n" ); + output( "\tpushl %%fs:(0)\n" ); + output( "\tmovl %%esp,%%fs:(0)\n" );
/* Call the actual CallTo16 routine (simulate a lcall) */ output( "\tpushl %%cs\n" ); output( "\tcall .L%s\n", name );
/* Remove exception frame */ - output( "\t.byte 0x64\n\tpopl (0)\n" ); + output( "\tpopl %%fs:(0)\n" ); output( "\taddl $4, %%esp\n" ); - output( "\t.byte 0x64\n\tpopl (%d)\n", STACKOFFSET ); + output( "\tpopl %%fs:(%d)\n", STACKOFFSET );
if ( !reg_func ) { @@ -453,9 +453,9 @@ static void BuildCallTo16Core( int reg_func )
/* Switch to the 16-bit stack */ output( "\tmovl %%esp,%%edx\n" ); - output( "\t.byte 0x64\n\tmovw (%d),%%ss\n", STACKOFFSET + 2); - output( "\t.byte 0x64\n\tmovw (%d),%%sp\n", STACKOFFSET ); - output( "\t.byte 0x64\n\tmovl %%edx,(%d)\n", STACKOFFSET ); + output( "\tmovw %%fs:(%d),%%ss\n", STACKOFFSET + 2); + output( "\tmovw %%fs:(%d),%%sp\n", STACKOFFSET ); + output( "\tmovl %%edx,%%fs:(%d)\n", STACKOFFSET );
/* Make %bp point to the previous stackframe (built by CallFrom16) */ output( "\tmovzwl %%sp,%%ebp\n" ); @@ -526,20 +526,20 @@ static void BuildRet16Func(void)
/* Restore 32-bit segment registers */
- output( "\t.byte 0x2e\n\tmovl %s", asm_name("CallTo16_DataSelector") ); + output( "\tmovl %%cs:%s", asm_name("CallTo16_DataSelector") ); output( "-%s,%%edi\n", asm_name("__wine_call16_start") ); output( "\tmovw %%di,%%ds\n" ); output( "\tmovw %%di,%%es\n" );
- output( "\t.byte 0x2e\n\tmov %s", asm_name("CallTo16_TebSelector") ); + output( "\tmov %%cs:%s", asm_name("CallTo16_TebSelector") ); output( "-%s,%%fs\n", asm_name("__wine_call16_start") );
- output( "\t.byte 0x64\n\tmov (%d),%%gs\n", GS_OFFSET ); + output( "\tmov %%fs:(%d),%%gs\n", GS_OFFSET );
/* Restore the 32-bit stack */
output( "\tmovw %%di,%%ss\n" ); - output( "\t.byte 0x64\n\tmovl (%d),%%esp\n", STACKOFFSET ); + output( "\tmovl %%fs:(%d),%%esp\n", STACKOFFSET );
/* Return to caller */
From: Zebediah Figura zfigura@codeweavers.com
We already use it in the __wine_spec_callfrom16_* functions. --- tools/winebuild/relay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index 1b01d49d4b5..d07464c53e5 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -504,8 +504,7 @@ static void BuildCallTo16Core( int reg_func ) }
/* Jump to the called routine */ - output( "\t.byte 0x66\n" ); - output( "\tlret\n" ); + output( "\tlretw\n" );
/* Function footer */ output_function_size( func_name );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=133211
Your paranoid android.
=== debian11 (32 bit report) ===
user32: msg.c:6897: Test failed: SetFocus(hwnd) on a button: 4: the msg 0x0007 was expected, but got msg 0x0005 instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 5: the msg 0x0138 was expected, but got msg 0x030f instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 6: the msg 0x0111 was expected, but got msg 0x001c instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 8: the msg 0x8000 was expected, but got msg 0x0086 instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 9: the msg sequence is not complete: expected 0000 - actual 0006
We always compile i386 code without PIC in Wine
That's only true on Linux, this will break other platforms like Android.