ntdll: Move the plaform-independent thread data to the GdiTebBatch TEB field.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-07-19 15:18:29 +02:00
parent f1ef8a4d9d
commit b87c66dd65
3 changed files with 20 additions and 29 deletions

View file

@ -212,37 +212,28 @@ struct debug_info
char output[1024]; /* current output line */
};
/* thread private data, stored in NtCurrentTeb()->SpareBytes1 */
/* thread private data, stored in NtCurrentTeb()->GdiTebBatch */
struct ntdll_thread_data
{
#ifdef __i386__
DWORD dr0; /* 1bc Debug registers */
DWORD dr1; /* 1c0 */
DWORD dr2; /* 1c4 */
DWORD dr3; /* 1c8 */
DWORD dr6; /* 1cc */
DWORD dr7; /* 1d0 */
DWORD fs; /* 1d4 TEB selector */
DWORD gs; /* 1d8 libc selector; update winebuild if you move this! */
void *vm86_ptr; /* 1dc data for vm86 mode */
#else
void *exit_frame; /* /2e8 exit frame pointer */
#endif
struct debug_info *debug_info; /* 1e0/2f0 info for debugstr functions */
int request_fd; /* 1e4/2f8 fd for sending server requests */
int reply_fd; /* 1e8/2fc fd for receiving server replies */
int wait_fd[2]; /* 1ec/300 fd for sleeping server requests */
BOOL wow64_redir; /* 1f4/308 Wow64 filesystem redirection flag */
pthread_t pthread_id; /* 1f8/310 pthread thread id */
#ifdef __i386__
WINE_VM86_TEB_INFO vm86; /* 1fc vm86 private data */
void *exit_frame; /* 204 exit frame pointer */
WINE_VM86_TEB_INFO __vm86; /* FIXME: placeholder for vm86 data from struct x86_thread_data */
#endif
struct debug_info *debug_info; /* info for debugstr functions */
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
int wait_fd[2]; /* fd for sleeping server requests */
BOOL wow64_redir; /* Wow64 filesystem redirection flag */
pthread_t pthread_id; /* pthread thread id */
};
C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) );
#ifdef __i386__
C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct ntdll_thread_data, __vm86 ) == 0x1fc );
#endif
static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
{
return (struct ntdll_thread_data *)NtCurrentTeb()->SpareBytes1;
return (struct ntdll_thread_data *)&NtCurrentTeb()->GdiTebBatch;
}
extern mode_t FILE_umask DECLSPEC_HIDDEN;

View file

@ -332,7 +332,7 @@ HANDLE thread_init(void)
teb->StaticUnicodeString.Buffer = teb->StaticUnicodeBuffer;
teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer);
thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
thread_data->request_fd = -1;
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
@ -440,7 +440,7 @@ void exit_thread( int status )
if ((teb = interlocked_xchg_ptr( &prev_teb, NtCurrentTeb() )))
{
struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
if (thread_data->pthread_id)
{
@ -465,7 +465,7 @@ void exit_thread( int status )
static void start_thread( struct startup_info *info )
{
TEB *teb = info->teb;
struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
PRTL_THREAD_START_ROUTINE func = info->entry_point;
void *arg = info->entry_arg;
struct debug_info debug_info;
@ -585,7 +585,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
info->entry_point = start;
info->entry_arg = param;
thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
thread_data->request_fd = request_pipe[1];
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
@ -1027,7 +1027,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
{
if (sel == (wine_get_cs() & ~3))
tdi->Entry.HighWord.Bits.Type |= 8; /* code segment */
else if (sel == (ntdll_get_thread_data()->fs & ~3))
else if (sel == (wine_get_fs() & ~3))
{
ULONG_PTR fs_base = (ULONG_PTR)NtCurrentTeb();
tdi->Entry.BaseLow = fs_base & 0xffff;

View file

@ -330,7 +330,7 @@ typedef struct _TEB
ACTIVATION_CONTEXT_STACK ActivationContextStack; /* 1a8/02c8 */
BYTE SpareBytes1[24]; /* 1bc/02e8 used for ntdll private data in Wine */
PVOID SystemReserved2[10]; /* 1d4/0300 used for ntdll private data in Wine */
GDI_TEB_BATCH GdiTebBatch; /* 1fc/0350 used for vm86 private data in Wine */
GDI_TEB_BATCH GdiTebBatch; /* 1fc/0350 used for ntdll private data in Wine */
HANDLE gdiRgn; /* 6dc/0838 */
HANDLE gdiPen; /* 6e0/0840 */
HANDLE gdiBrush; /* 6e4/0848 */