Alexandre Julliard : ntdll: Move the %gs register to the
ntdll_thread_regs structure.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jan 20 13:20:25 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 4ce433d82630b38d9f6d44c0fb377dbb88f4c16d
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4ce433d82630b38d9f6d44c0fb377dbb88f4c16d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jan 20 16:54:11 2006 +0100
ntdll: Move the %gs register to the ntdll_thread_regs structure.
---
dlls/ntdll/ntdll_misc.h | 17 +++++++++--------
dlls/ntdll/signal_i386.c | 2 +-
include/thread.h | 9 ++++-----
tools/winebuild/relay.c | 9 ++++++---
4 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 992df1d..7932b50 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -136,14 +136,15 @@ static inline struct ntdll_thread_data *
/* 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)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 11e9dc9..fcdccfd 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -675,7 +675,7 @@ inline static void *init_handler( const
* 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
diff --git a/include/thread.h b/include/thread.h
index d5f1914..13e87b8 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -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 */
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 60ed6cc..5dbbe83 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -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 *o
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 *out
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 *outfil
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 */
More information about the wine-cvs
mailing list