From 9a07d210f135c91dda89d888dcedac864ff36781 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 27 Jul 2017 10:50:41 +0200 Subject: [PATCH] server: Add a platform-specific entry point to initialize registers of a new thread. Signed-off-by: Alexandre Julliard --- server/mach.c | 5 +++++ server/procfs.c | 5 +++++ server/ptrace.c | 15 +++++++++++++++ server/thread.c | 1 + server/thread.h | 1 + 5 files changed, 27 insertions(+) diff --git a/server/mach.c b/server/mach.c index 2ef6e59c583..9d8d911cb7c 100644 --- a/server/mach.c +++ b/server/mach.c @@ -148,6 +148,11 @@ void finish_process_tracing( struct process *process ) } } +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { diff --git a/server/procfs.c b/server/procfs.c index 5caa02b66df..7b61b2abb46 100644 --- a/server/procfs.c +++ b/server/procfs.c @@ -202,6 +202,11 @@ error: close( fd ); } +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { diff --git a/server/ptrace.c b/server/ptrace.c index cb436b6f08f..7de506be0e3 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -542,6 +542,11 @@ void get_selector_entry( struct thread *thread, int entry, unsigned int *base, /* debug register offset in struct user */ #define DR_OFFSET(dr) ((((struct user *)0)->u_debugreg) + (dr)) +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { @@ -652,6 +657,11 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign #include +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { @@ -726,6 +736,11 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign #else /* linux || __FreeBSD__ */ +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { diff --git a/server/thread.c b/server/thread.c index 70f5f28739e..24e9af511a4 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1317,6 +1317,7 @@ DECL_HANDLER(init_thread) } if (process->unix_pid != current->unix_pid) process->unix_pid = -1; /* can happen with linuxthreads */ + init_thread_context( current ); stop_thread_if_suspended( current ); generate_debug_event( current, CREATE_THREAD_DEBUG_EVENT, &req->entry ); set_thread_affinity( current, current->affinity ); diff --git a/server/thread.h b/server/thread.h index 282199149e6..2fdfd662735 100644 --- a/server/thread.h +++ b/server/thread.h @@ -131,6 +131,7 @@ extern int is_cpu_supported( enum cpu_type cpu ); /* ptrace functions */ extern void sigchld_callback(void); +extern void init_thread_context( struct thread *thread ); extern void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ); extern void set_thread_context( struct thread *thread, const context_t *context, unsigned int flags ); extern int send_thread_signal( struct thread *thread, int sig );