ntdll: Store the thread startup info in the ntdll_thread_data structure.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-24 11:15:42 +02:00
parent 0e3f8c54c1
commit e3b059b5ba
2 changed files with 6 additions and 15 deletions

View File

@ -83,13 +83,6 @@ static void pthread_exit_wrapper( int status )
}
/* info passed to a starting thread */
struct startup_info
{
PRTL_THREAD_START_ROUTINE entry;
void *arg;
};
/***********************************************************************
* start_thread
*
@ -97,7 +90,6 @@ struct startup_info
*/
static void start_thread( TEB *teb )
{
struct startup_info *info = (struct startup_info *)(teb + 1);
struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
struct debug_info debug_info;
BOOL suspend;
@ -106,8 +98,8 @@ static void start_thread( TEB *teb )
thread_data->debug_info = &debug_info;
thread_data->pthread_id = pthread_self();
signal_init_thread( teb );
server_init_thread( info->entry, &suspend );
signal_start_thread( info->entry, info->arg, suspend, pRtlUserThreadStart, teb );
server_init_thread( thread_data->start, &suspend );
signal_start_thread( thread_data->start, thread_data->param, suspend, pRtlUserThreadStart, teb );
}
@ -152,7 +144,6 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
data_size_t len;
struct object_attributes *objattr;
struct ntdll_thread_data *thread_data;
struct startup_info *info;
DWORD tid = 0;
int request_pipe[2];
SIZE_T extra_stack = PTHREAD_STACK_MIN;
@ -236,10 +227,6 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
client_id.UniqueThread = ULongToHandle( tid );
teb->ClientId = client_id;
info = (struct startup_info *)(teb + 1);
info->entry = start;
info->arg = param;
teb->Tib.StackBase = stack.StackBase;
teb->Tib.StackLimit = stack.StackLimit;
teb->DeallocationStack = stack.DeallocationStack;
@ -247,6 +234,8 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
thread_data->request_fd = request_pipe[1];
thread_data->start_stack = (char *)teb->Tib.StackBase;
thread_data->start = start;
thread_data->param = param;
pthread_attr_init( &pthread_attr );
pthread_attr_setstack( &pthread_attr, teb->DeallocationStack,

View File

@ -60,6 +60,8 @@ struct ntdll_thread_data
BOOL wow64_redir; /* Wow64 filesystem redirection flag */
pthread_t pthread_id; /* pthread thread id */
struct list entry; /* entry in TEB list */
PRTL_THREAD_START_ROUTINE start; /* thread entry point */
void *param; /* thread entry point parameter */
};
C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) );