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