Properly save/restore %gs register across 16-bit calls.

This commit is contained in:
Alexandre Julliard 2003-02-27 21:11:13 +00:00
parent 7e92c9af7b
commit 551797bc57
4 changed files with 9 additions and 1 deletions

View file

@ -575,6 +575,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
vm86 = *(struct vm86plus_struct **)(ESP_sig(sigcontext) + sizeof(int));
/* get context from vm86 struct */
save_vm86_context( context, vm86 );
wine_set_gs( NtCurrentTeb()->gs_sel );
return;
}
}
@ -601,6 +602,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
#else
context->SegGs = wine_get_gs();
#endif
wine_set_gs( NtCurrentTeb()->gs_sel );
}

View file

@ -105,7 +105,8 @@ typedef struct _TEB
/* The following are Wine-specific fields (NT: GDI stuff) */
UINT code_page; /* --3 1fc Thread code page */
DWORD unused[3]; /* --3 200 Was server buffer */
DWORD unused[2]; /* --3 200 Was server buffer */
DWORD gs_sel; /* --3 208 %gs selector for this thread */
int request_fd; /* --3 20c fd for sending server requests */
int reply_fd; /* --3 210 fd for receiving server replies */
int wait_fd[2]; /* --3 214 fd for sleeping server requests */

View file

@ -92,6 +92,7 @@ void SYSDEPS_SetCurThread( TEB *teb )
wine_ldt_set_limit( &fs_entry, 0xfff );
wine_ldt_set_flags( &fs_entry, WINE_LDT_FLAGS_DATA|WINE_LDT_FLAGS_32BIT );
wine_ldt_init_fs( teb->teb_sel, &fs_entry );
teb->gs_sel = wine_get_gs();
#elif defined(__powerpc__)
/* On PowerPC, the current TEB is in the gpr13 register */
__asm__ __volatile__("mr 2, %0" : : "r" (teb));

View file

@ -175,6 +175,8 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
else
fprintf( outfile, "\tmovw " __ASM_NAME("SYSLEVEL_Win16CurrentTeb") ", %%fs\n" );
fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) );
/* Get address of wine_ldt_copy array into %ecx */
if ( UsePIC )
fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy@GOT") "(%%ecx), %%ecx\n" );
@ -733,6 +735,8 @@ static void BuildRet16Func( FILE *outfile )
fprintf( outfile, "\tmovw " __ASM_NAME("SYSLEVEL_Win16CurrentTeb") ",%%fs\n" );
fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) );
/* Restore the 32-bit stack */
#ifdef __svr4__