ntdll: Move the %gs register to the ntdll_thread_regs structure.

This commit is contained in:
Alexandre Julliard 2006-01-20 16:54:11 +01:00
parent a19e3eeb20
commit 4ce433d826
4 changed files with 20 additions and 17 deletions

View File

@ -136,14 +136,15 @@ static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
/* thread registers, stored in NtCurrentTeb()->SpareBytes1 */
struct ntdll_thread_regs
{
DWORD fs; /* TEB selector */
DWORD dr0; /* debug registers */
DWORD dr1;
DWORD dr2;
DWORD dr3;
DWORD dr6;
DWORD dr7;
DWORD spare[3]; /* change this if you add fields! */
DWORD fs; /* 00 TEB selector */
DWORD gs; /* 04 libc selector; update winebuild if you move this! */
DWORD dr0; /* 08 debug registers */
DWORD dr1; /* 0c */
DWORD dr2; /* 10 */
DWORD dr3; /* 14 */
DWORD dr6; /* 18 */
DWORD dr7; /* 1c */
DWORD spare[2]; /* 20 change this if you add fields! */
};
static inline struct ntdll_thread_regs *ntdll_get_thread_regs(void)

View File

@ -675,7 +675,7 @@ inline static void *init_handler( const SIGCONTEXT *sigcontext, WORD *fs, WORD *
* SS is still non-system segment. This is why both CS and SS
* are checked.
*/
wine_set_gs( teb->gs_sel );
wine_set_gs( thread_regs->gs );
stack = teb->WOW32Reserved;
}
#ifdef __HAVE_VM86

View File

@ -53,12 +53,11 @@ typedef struct _TEB
PVOID SystemReserved2[10]; /* 1d4 */
/* The following are Wine-specific fields (NT: GdiTebBatch) */
DWORD gs_sel; /* 1fc %gs selector for this thread */
ULONG_PTR num_async_io; /* 200 number of pending async I/O in the server */
DWORD dpmi_vif; /* 204 protected mode virtual interrupt flag */
DWORD vm86_pending; /* 208 data for vm86 mode */
DWORD num_async_io; /* 1fc number of pending async I/O in the server */
ULONG_PTR dpmi_vif; /* 200 protected mode virtual interrupt flag */
DWORD vm86_pending; /* 204 data for vm86 mode */
/* here is plenty space for wine specific fields (don't forget to change pad6!!) */
DWORD pad6[308]; /* 20c */
DWORD pad6[309]; /* 208 */
ULONG gdiRgn; /* 6dc */
ULONG gdiPen; /* 6e0 */

View File

@ -32,6 +32,9 @@
#include "build.h"
/* fix this if the ntdll_thread_regs structure is changed */
#define GS_OFFSET 0x1b0 /* STRUCTOFFSET(TEB,SpareBytes1) + STRUCTOFFSET(ntdll_thread_regs,gs) */
static void function_header( FILE *outfile, const char *name )
{
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
@ -150,7 +153,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk )
else
fprintf( outfile, "\tmovw %s, %%fs\n", asm_name("CallTo16_TebSelector") );
fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) );
fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", GS_OFFSET );
/* Translate STACK16FRAME base to flat offset in %edx */
fprintf( outfile, "\tmovw %%ss, %%dx\n" );
@ -393,7 +396,7 @@ static void BuildCallTo16Core( FILE *outfile, int reg_func )
fprintf( outfile, "\tpushl %%ebx\n" );
fprintf( outfile, "\tpushl %%esi\n" );
fprintf( outfile, "\tpushl %%edi\n" );
fprintf( outfile, "\t.byte 0x64\n\tmov %%gs,(%d)\n", STRUCTOFFSET(TEB,gs_sel) );
fprintf( outfile, "\t.byte 0x64\n\tmov %%gs,(%d)\n", GS_OFFSET );
/* Setup exception frame */
fprintf( outfile, "\t.byte 0x64\n\tpushl (%d)\n", STACKOFFSET );
@ -542,7 +545,7 @@ static void BuildRet16Func( FILE *outfile )
fprintf( outfile, "\t.byte 0x2e\n\tmov %s", asm_name("CallTo16_TebSelector") );
fprintf( outfile, "-%s,%%fs\n", asm_name("__wine_call16_start") );
fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) );
fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", GS_OFFSET );
/* Restore the 32-bit stack */