server: Define a generic context structure instead of using the platform-specific version.
diff --git a/server/mach.c b/server/mach.c
index fcc87a3..f9490f3 100644
--- a/server/mach.c
+++ b/server/mach.c
@@ -160,7 +160,7 @@
}
/* retrieve the thread x86 registers */
-void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
+void get_thread_context( struct thread *thread, context_t *context, unsigned int flags )
{
#ifdef __i386__
x86_debug_state32_t state;
@@ -169,7 +169,7 @@
mach_port_t port, process_port = get_process_port( thread->process );
/* all other regs are handled on the client side */
- assert( (flags | CONTEXT_i386) == CONTEXT_DEBUG_REGISTERS );
+ assert( flags == SERVER_CTX_DEBUG_REGISTERS );
if (thread->unix_pid == -1 || !process_port ||
mach_port_extract_right( process_port, thread->unix_tid,
@@ -183,28 +183,28 @@
{
/* work around silly renaming of struct members in OS X 10.5 */
#if __DARWIN_UNIX03 && defined(_STRUCT_X86_DEBUG_STATE32)
- context->Dr0 = state.__dr0;
- context->Dr1 = state.__dr1;
- context->Dr2 = state.__dr2;
- context->Dr3 = state.__dr3;
- context->Dr6 = state.__dr6;
- context->Dr7 = state.__dr7;
+ context->debug.i386_regs.dr0 = state.__dr0;
+ context->debug.i386_regs.dr1 = state.__dr1;
+ context->debug.i386_regs.dr2 = state.__dr2;
+ context->debug.i386_regs.dr3 = state.__dr3;
+ context->debug.i386_regs.dr6 = state.__dr6;
+ context->debug.i386_regs.dr7 = state.__dr7;
#else
- context->Dr0 = state.dr0;
- context->Dr1 = state.dr1;
- context->Dr2 = state.dr2;
- context->Dr3 = state.dr3;
- context->Dr6 = state.dr6;
- context->Dr7 = state.dr7;
+ context->debug.i386_regs.dr0 = state.dr0;
+ context->debug.i386_regs.dr1 = state.dr1;
+ context->debug.i386_regs.dr2 = state.dr2;
+ context->debug.i386_regs.dr3 = state.dr3;
+ context->debug.i386_regs.dr6 = state.dr6;
+ context->debug.i386_regs.dr7 = state.dr7;
#endif
- context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
+ context->flags |= SERVER_CTX_DEBUG_REGISTERS;
}
mach_port_deallocate( mach_task_self(), port );
#endif
}
/* set the thread x86 registers */
-void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned int flags )
+void set_thread_context( struct thread *thread, const context_t *context, unsigned int flags )
{
#ifdef __i386__
x86_debug_state32_t state;
@@ -213,7 +213,7 @@
mach_port_t port, process_port = get_process_port( thread->process );
/* all other regs are handled on the client side */
- assert( (flags | CONTEXT_i386) == CONTEXT_DEBUG_REGISTERS );
+ assert( flags == SERVER_CTX_DEBUG_REGISTERS );
if (thread->unix_pid == -1 || !process_port ||
mach_port_extract_right( process_port, thread->unix_tid,
@@ -224,35 +224,28 @@
}
#if __DARWIN_UNIX03 && defined(_STRUCT_X86_DEBUG_STATE32)
- state.__dr0 = context->Dr0;
- state.__dr1 = context->Dr1;
- state.__dr2 = context->Dr2;
- state.__dr3 = context->Dr3;
+ state.__dr0 = context->debug.i386_regs.dr0;
+ state.__dr1 = context->debug.i386_regs.dr1;
+ state.__dr2 = context->debug.i386_regs.dr2;
+ state.__dr3 = context->debug.i386_regs.dr3;
state.__dr4 = 0;
state.__dr5 = 0;
- state.__dr6 = context->Dr6;
- state.__dr7 = context->Dr7;
+ state.__dr6 = context->debug.i386_regs.dr6;
+ state.__dr7 = context->debug.i386_regs.dr7;
#else
- state.dr0 = context->Dr0;
- state.dr1 = context->Dr1;
- state.dr2 = context->Dr2;
- state.dr3 = context->Dr3;
+ state.dr0 = context->debug.i386_regs.dr0;
+ state.dr1 = context->debug.i386_regs.dr1;
+ state.dr2 = context->debug.i386_regs.dr2;
+ state.dr3 = context->debug.i386_regs.dr3;
state.dr4 = 0;
state.dr5 = 0;
- state.dr6 = context->Dr6;
- state.dr7 = context->Dr7;
+ state.dr6 = context->debug.i386_regs.dr6;
+ state.dr7 = context->debug.i386_regs.dr7;
#endif
if (!thread_set_state( port, x86_DEBUG_STATE32, (thread_state_t)&state, count ))
{
if (thread->context) /* update the cached values */
- {
- thread->context->Dr0 = context->Dr0;
- thread->context->Dr1 = context->Dr1;
- thread->context->Dr2 = context->Dr2;
- thread->context->Dr3 = context->Dr3;
- thread->context->Dr6 = context->Dr6;
- thread->context->Dr7 = context->Dr7;
- }
+ thread->context->debug.i386_regs = context->debug.i386_regs;
}
mach_port_deallocate( mach_task_self(), port );
#endif