Alexandre Julliard : ntdll: Move initialization of the debug registers to signal_i386.c.
Alexandre Julliard
julliard at winehq.org
Thu Nov 19 10:15:23 CST 2009
Module: wine
Branch: master
Commit: aced1b82ba06d53db45782b505af352562cfee58
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aced1b82ba06d53db45782b505af352562cfee58
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Nov 19 12:26:21 2009 +0100
ntdll: Move initialization of the debug registers to signal_i386.c.
---
dlls/ntdll/signal_i386.c | 15 +++++++++++++++
dlls/ntdll/thread.c | 10 ----------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 9ec739c..48e3ef1 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -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;
}
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 1c8a617..c38298a 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -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 );
More information about the wine-cvs
mailing list