ntdll: Move the plaform-specific thread data to the SystemReserved2 TEB field.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-07-19 15:20:42 +02:00
parent b87c66dd65
commit 9e59362ae3
4 changed files with 23 additions and 17 deletions

View File

@ -531,25 +531,31 @@ enum i386_trap_code
struct x86_thread_data
{
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 */
int __pad[7]; /* 1e0 space for ntdll_thread_data (FIXME) */
DWORD dr0; /* 1dc debug registers */
DWORD dr1; /* 1e0 */
DWORD dr2; /* 1e4 */
DWORD dr3; /* 1e8 */
DWORD dr6; /* 1ec */
DWORD dr7; /* 1f0 */
void *exit_frame; /* 1f4 exit frame pointer */
#ifdef __HAVE_VM86
void *vm86_ptr; /* 1f8 data for vm86 mode */
WINE_VM86_TEB_INFO vm86; /* 1fc vm86 private data */
void *exit_frame; /* 204 exit frame pointer */
#endif
/* the ntdll_thread_data structure follows here */
};
C_ASSERT( offsetof( TEB, SpareBytes1 ) + offsetof( struct x86_thread_data, gs ) == 0x1d8 );
C_ASSERT( offsetof( TEB, SystemReserved2 ) + offsetof( struct x86_thread_data, gs ) == 0x1d8 );
#ifdef __HAVE_VM86
C_ASSERT( offsetof( TEB, SystemReserved2 ) + offsetof( struct x86_thread_data, vm86 ) ==
offsetof( TEB, GdiTebBatch ) + offsetof( struct ntdll_thread_data, __vm86 ));
#endif
static inline struct x86_thread_data *x86_thread_data(void)
{
return (struct x86_thread_data *)NtCurrentTeb()->SpareBytes1;
return (struct x86_thread_data *)NtCurrentTeb()->SystemReserved2;
}
/* Exception record for handling exceptions happening inside exception handlers */

View File

@ -313,11 +313,11 @@ struct amd64_thread_data
void *exit_frame; /* exit frame pointer */
};
C_ASSERT( sizeof(struct amd64_thread_data) <= sizeof(((TEB *)0)->SpareBytes1) );
C_ASSERT( sizeof(struct amd64_thread_data) <= sizeof(((TEB *)0)->SystemReserved2) );
static inline struct amd64_thread_data *amd64_thread_data(void)
{
return (struct amd64_thread_data *)NtCurrentTeb()->SpareBytes1;
return (struct amd64_thread_data *)NtCurrentTeb()->SystemReserved2;
}
/***********************************************************************

View File

@ -328,8 +328,8 @@ typedef struct _TEB
PVOID SystemReserved1[54]; /* 0cc/0110 used for kernel32 private data in Wine */
LONG ExceptionCode; /* 1a4/02c0 */
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 */
BYTE SpareBytes1[24]; /* 1bc/02e8 */
PVOID SystemReserved2[10]; /* 1d4/0300 used for ntdll platform-specific 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 */

View File

@ -33,8 +33,8 @@
/* offset of the stack pointer relative to %fs:(0) */
#define STACKOFFSET 0xc0 /* FIELD_OFFSET(TEB,WOW32Reserved) */
/* fix this if the ntdll_thread_regs structure is changed */
#define GS_OFFSET 0x1d8 /* FIELD_OFFSET(TEB,SpareBytes1) + FIELD_OFFSET(ntdll_thread_data,gs) */
/* fix this if the x86_thread_data structure is changed */
#define GS_OFFSET 0x1d8 /* FIELD_OFFSET(TEB,SystemReserved2) + FIELD_OFFSET(struct x86_thread_data,gs) */
#define DPMI_VIF_OFFSET (0x1fc + 0) /* FIELD_OFFSET(TEB,GdiTebBatch) + FIELD_OFFSET(WINE_VM86_TEB_INFO,dpmi_vif) */
#define VM86_PENDING_OFFSET (0x1fc + 4) /* FIELD_OFFSET(TEB,GdiTebBatch) + FIELD_OFFSET(WINE_VM86_TEB_INFO,vm86_pending) */