Commit aced1b82 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move initialization of the debug registers to signal_i386.c.

parent d4f1fffa
......@@ -2014,6 +2014,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
{
static size_t sigstack_zero_bits;
struct ntdll_thread_data *thread_data;
TEB *parent = NULL;
SIZE_T size;
void *addr = NULL;
NTSTATUS status;
......@@ -2027,6 +2028,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
signal_stack_mask = (1 << sigstack_zero_bits) - 1;
signal_stack_size = (1 << sigstack_zero_bits) - teb_size;
}
else parent = NtCurrentTeb();
size = signal_stack_mask + 1;
if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, sigstack_zero_bits,
......@@ -2042,6 +2044,19 @@ NTSTATUS signal_alloc_thread( TEB **teb )
NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE );
status = STATUS_TOO_MANY_THREADS;
}
if (parent)
{
/* inherit debug registers from parent thread */
struct ntdll_thread_regs *parent_regs = (struct ntdll_thread_regs *)parent->SpareBytes1;
struct ntdll_thread_regs *thread_regs = (struct ntdll_thread_regs *)(*teb)->SpareBytes1;
thread_regs->dr0 = parent_regs->dr0;
thread_regs->dr1 = parent_regs->dr1;
thread_regs->dr2 = parent_regs->dr2;
thread_regs->dr3 = parent_regs->dr3;
thread_regs->dr6 = parent_regs->dr6;
thread_regs->dr7 = parent_regs->dr7;
}
}
return status;
}
......
......@@ -451,7 +451,6 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
pthread_t pthread_id;
pthread_attr_t attr;
struct ntdll_thread_data *thread_data;
struct ntdll_thread_regs *thread_regs;
struct startup_info *info = NULL;
HANDLE handle = 0;
TEB *teb = NULL;
......@@ -524,20 +523,11 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
info->entry_arg = param;
thread_data = (struct ntdll_thread_data *)teb->SystemReserved2;
thread_regs = (struct ntdll_thread_regs *)teb->SpareBytes1;
thread_data->request_fd = request_pipe[1];
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
/* inherit debug registers from parent thread */
thread_regs->dr0 = ntdll_get_thread_regs()->dr0;
thread_regs->dr1 = ntdll_get_thread_regs()->dr1;
thread_regs->dr2 = ntdll_get_thread_regs()->dr2;
thread_regs->dr3 = ntdll_get_thread_regs()->dr3;
thread_regs->dr6 = ntdll_get_thread_regs()->dr6;
thread_regs->dr7 = ntdll_get_thread_regs()->dr7;
if ((status = virtual_alloc_thread_stack( teb, stack_reserve, stack_commit ))) goto error;
pthread_attr_init( &attr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment