server: Set the context flags in get_thread_context to indicate which
parts of the returned context are valid.
This commit is contained in:
parent
b2c62c9455
commit
bd298b511e
|
@ -142,7 +142,7 @@ static void get_thread_context( struct thread *thread, unsigned int flags, CONTE
|
||||||
context->Fpcr = regs.regs[EF_SIZE/8+31];
|
context->Fpcr = regs.regs[EF_SIZE/8+31];
|
||||||
context->SoftFpcr = 0; /* FIXME */
|
context->SoftFpcr = 0; /* FIXME */
|
||||||
}
|
}
|
||||||
if (ptrace( PTRACE_SETREGS, pid, 0, ®s ) == -1) goto error;
|
context->ContextFlags |= flags & CONTEXT_FULL;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -231,6 +231,7 @@ static void set_thread_context( struct thread *thread, unsigned int flags, const
|
||||||
regs.regs[EF_SIZE/8+30] = context->FltF30;
|
regs.regs[EF_SIZE/8+30] = context->FltF30;
|
||||||
regs.regs[EF_SIZE/8+31] = context->Fpcr;
|
regs.regs[EF_SIZE/8+31] = context->Fpcr;
|
||||||
}
|
}
|
||||||
|
if (ptrace( PTRACE_SETREGS, pid, 0, ®s ) == -1) goto error;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -238,7 +239,7 @@ static void set_thread_context( struct thread *thread, unsigned int flags, const
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy a context structure according to the flags */
|
/* copy a context structure according to the flags */
|
||||||
static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
static void copy_context( CONTEXT *to, const CONTEXT *from, unsigned int flags )
|
||||||
{
|
{
|
||||||
if (flags & CONTEXT_CONTROL)
|
if (flags & CONTEXT_CONTROL)
|
||||||
{
|
{
|
||||||
|
@ -317,6 +318,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
||||||
to->Fpcr = from->Fpcr;
|
to->Fpcr = from->Fpcr;
|
||||||
to->SoftFpcr = from->SoftFpcr;
|
to->SoftFpcr = from->SoftFpcr;
|
||||||
}
|
}
|
||||||
|
to->ContextFlags |= flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve the current instruction pointer of a thread */
|
/* retrieve the current instruction pointer of a thread */
|
||||||
|
@ -346,61 +348,37 @@ int tkill( int pid, int sig )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve the current context of a thread */
|
/* retrieve the thread context */
|
||||||
DECL_HANDLER(get_thread_context)
|
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
struct thread *thread;
|
context->ContextFlags |= CONTEXT_ALPHA;
|
||||||
void *data;
|
flags &= ~CONTEXT_ALPHA; /* get rid of CPU id */
|
||||||
int flags = req->flags & ~CONTEXT_ALPHA; /* get rid of CPU id */
|
|
||||||
|
|
||||||
if (get_reply_max_size() < sizeof(CONTEXT))
|
if (thread->context) /* thread is inside an exception event or suspended */
|
||||||
{
|
{
|
||||||
set_error( STATUS_INVALID_PARAMETER );
|
copy_context( context, thread->context, flags );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!(thread = get_thread_from_handle( req->handle, THREAD_GET_CONTEXT ))) return;
|
else if (flags && suspend_for_ptrace( thread ))
|
||||||
|
|
||||||
if ((data = set_reply_data_size( sizeof(CONTEXT) )))
|
|
||||||
{
|
{
|
||||||
if (thread->context) /* thread is inside an exception event */
|
get_thread_context_ptrace( thread, flags, context );
|
||||||
{
|
|
||||||
copy_context( data, thread->context, flags );
|
|
||||||
flags = 0;
|
|
||||||
}
|
|
||||||
if (flags && suspend_for_ptrace( thread ))
|
|
||||||
{
|
|
||||||
get_thread_context( thread, flags, data );
|
|
||||||
resume_after_ptrace( thread );
|
resume_after_ptrace( thread );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release_object( thread );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the current context of a thread */
|
/* set the thread context */
|
||||||
DECL_HANDLER(set_thread_context)
|
void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
struct thread *thread;
|
flags &= ~CONTEXT_ALPHA; /* get rid of CPU id */
|
||||||
int flags = req->flags & ~CONTEXT_ALPHA; /* get rid of CPU id */
|
|
||||||
|
|
||||||
if (get_req_data_size() < sizeof(CONTEXT))
|
if (thread->context) /* thread is inside an exception event or suspended */
|
||||||
{
|
{
|
||||||
set_error( STATUS_INVALID_PARAMETER );
|
copy_context( thread->context, context, flags );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if ((thread = get_thread_from_handle( req->handle, THREAD_SET_CONTEXT )))
|
else if (flags && suspend_for_ptrace( thread ))
|
||||||
{
|
{
|
||||||
if (thread->context) /* thread is inside an exception event */
|
set_thread_context_ptrace( thread, flags, context );
|
||||||
{
|
|
||||||
copy_context( thread->context, get_req_data(), flags );
|
|
||||||
flags = 0;
|
|
||||||
}
|
|
||||||
if (flags && suspend_for_ptrace( thread ))
|
|
||||||
{
|
|
||||||
set_thread_context( thread, flags, get_req_data() );
|
|
||||||
resume_after_ptrace( thread );
|
resume_after_ptrace( thread );
|
||||||
}
|
}
|
||||||
release_object( thread );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __ALPHA__ */
|
#endif /* __ALPHA__ */
|
||||||
|
|
|
@ -147,6 +147,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
context->SegFs = regs.fs;
|
context->SegFs = regs.fs;
|
||||||
context->SegGs = regs.gs;
|
context->SegGs = regs.gs;
|
||||||
}
|
}
|
||||||
|
context->ContextFlags |= flags & CONTEXT_FULL;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_DEBUG_REGISTERS)
|
if (flags & CONTEXT_DEBUG_REGISTERS)
|
||||||
{
|
{
|
||||||
|
@ -156,6 +157,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
if (get_debug_reg( pid, 3, &context->Dr3 ) == -1) goto error;
|
if (get_debug_reg( pid, 3, &context->Dr3 ) == -1) goto error;
|
||||||
if (get_debug_reg( pid, 6, &context->Dr6 ) == -1) goto error;
|
if (get_debug_reg( pid, 6, &context->Dr6 ) == -1) goto error;
|
||||||
if (get_debug_reg( pid, 7, &context->Dr7 ) == -1) goto error;
|
if (get_debug_reg( pid, 7, &context->Dr7 ) == -1) goto error;
|
||||||
|
context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_FLOATING_POINT)
|
if (flags & CONTEXT_FLOATING_POINT)
|
||||||
{
|
{
|
||||||
|
@ -163,6 +165,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
/* correct structure (the same as fsave/frstor) */
|
/* correct structure (the same as fsave/frstor) */
|
||||||
if (ptrace( PTRACE_GETFPREGS, pid, 0, &context->FloatSave ) == -1) goto error;
|
if (ptrace( PTRACE_GETFPREGS, pid, 0, &context->FloatSave ) == -1) goto error;
|
||||||
context->FloatSave.Cr0NpxState = 0; /* FIXME */
|
context->FloatSave.Cr0NpxState = 0; /* FIXME */
|
||||||
|
context->ContextFlags |= CONTEXT_FLOATING_POINT;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -263,6 +266,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
context->SegFs = regs.r_fs & 0xffff;
|
context->SegFs = regs.r_fs & 0xffff;
|
||||||
context->SegGs = regs.r_gs & 0xffff;
|
context->SegGs = regs.r_gs & 0xffff;
|
||||||
}
|
}
|
||||||
|
context->ContextFlags |= flags & CONTEXT_FULL;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_DEBUG_REGISTERS)
|
if (flags & CONTEXT_DEBUG_REGISTERS)
|
||||||
{
|
{
|
||||||
|
@ -274,6 +278,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
/* correct structure (the same as fsave/frstor) */
|
/* correct structure (the same as fsave/frstor) */
|
||||||
if (ptrace( PTRACE_GETFPREGS, pid, (int) &context->FloatSave, 0 ) == -1) goto error;
|
if (ptrace( PTRACE_GETFPREGS, pid, (int) &context->FloatSave, 0 ) == -1) goto error;
|
||||||
context->FloatSave.Cr0NpxState = 0; /* FIXME */
|
context->FloatSave.Cr0NpxState = 0; /* FIXME */
|
||||||
|
context->ContextFlags |= CONTEXT_FLOATING_POINT;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -371,6 +376,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
context->SegFs = regs.r_fs & 0xffff;
|
context->SegFs = regs.r_fs & 0xffff;
|
||||||
context->SegGs = regs.r_gs & 0xffff;
|
context->SegGs = regs.r_gs & 0xffff;
|
||||||
}
|
}
|
||||||
|
context->ContextFlags |= flags & CONTEXT_FULL;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_DEBUG_REGISTERS)
|
if (flags & CONTEXT_DEBUG_REGISTERS)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +400,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
context->Dr6 = dbregs.dr6;
|
context->Dr6 = dbregs.dr6;
|
||||||
context->Dr7 = dbregs.dr7;
|
context->Dr7 = dbregs.dr7;
|
||||||
#endif
|
#endif
|
||||||
|
context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_FLOATING_POINT)
|
if (flags & CONTEXT_FLOATING_POINT)
|
||||||
|
@ -403,6 +409,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
/* correct structure (the same as fsave/frstor) */
|
/* correct structure (the same as fsave/frstor) */
|
||||||
if (ptrace( PTRACE_GETFPREGS, pid, (caddr_t) &context->FloatSave, 0 ) == -1) goto error;
|
if (ptrace( PTRACE_GETFPREGS, pid, (caddr_t) &context->FloatSave, 0 ) == -1) goto error;
|
||||||
context->FloatSave.Cr0NpxState = 0; /* FIXME */
|
context->FloatSave.Cr0NpxState = 0; /* FIXME */
|
||||||
|
context->ContextFlags |= CONTEXT_FLOATING_POINT;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -494,7 +501,7 @@ static void set_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
|
|
||||||
|
|
||||||
/* copy a context structure according to the flags */
|
/* copy a context structure according to the flags */
|
||||||
static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
static void copy_context( CONTEXT *to, const CONTEXT *from, unsigned int flags )
|
||||||
{
|
{
|
||||||
if (flags & CONTEXT_CONTROL)
|
if (flags & CONTEXT_CONTROL)
|
||||||
{
|
{
|
||||||
|
@ -527,6 +534,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
||||||
}
|
}
|
||||||
/* we don't bother copying the debug registers, since they */
|
/* we don't bother copying the debug registers, since they */
|
||||||
/* always need to be accessed by ptrace anyway */
|
/* always need to be accessed by ptrace anyway */
|
||||||
|
to->ContextFlags |= flags & ~CONTEXT_DEBUG_REGISTERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve the current instruction pointer of a thread */
|
/* retrieve the current instruction pointer of a thread */
|
||||||
|
@ -574,6 +582,7 @@ int tkill( int pid, int sig )
|
||||||
/* retrieve the thread context */
|
/* retrieve the thread context */
|
||||||
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
|
context->ContextFlags |= CONTEXT_i386;
|
||||||
flags &= ~CONTEXT_i386; /* get rid of CPU id */
|
flags &= ~CONTEXT_i386; /* get rid of CPU id */
|
||||||
|
|
||||||
if (thread->context) /* thread is inside an exception event or suspended */
|
if (thread->context) /* thread is inside an exception event or suspended */
|
||||||
|
|
|
@ -56,8 +56,6 @@
|
||||||
static void get_thread_context_ptrace( struct thread *thread, unsigned int flags, CONTEXT *context )
|
static void get_thread_context_ptrace( struct thread *thread, unsigned int flags, CONTEXT *context )
|
||||||
{
|
{
|
||||||
int pid = get_ptrace_pid(thread);
|
int pid = get_ptrace_pid(thread);
|
||||||
if (flags & CONTEXT_FULL)
|
|
||||||
{
|
|
||||||
if (flags & CONTEXT_INTEGER)
|
if (flags & CONTEXT_INTEGER)
|
||||||
{
|
{
|
||||||
#define XREG(x,y) if (ptrace( PTRACE_PEEKUSER, pid, (void*)(x<<2), &context->y) == -1) goto error;
|
#define XREG(x,y) if (ptrace( PTRACE_PEEKUSER, pid, (void*)(x<<2), &context->y) == -1) goto error;
|
||||||
|
@ -70,6 +68,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
#undef IREG
|
#undef IREG
|
||||||
XREG(37,Xer);
|
XREG(37,Xer);
|
||||||
XREG(38,Cr);
|
XREG(38,Cr);
|
||||||
|
context->ContextFlags |= CONTEXT_INTEGER;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_CONTROL)
|
if (flags & CONTEXT_CONTROL)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +76,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
XREG(33,Msr);
|
XREG(33,Msr);
|
||||||
XREG(35,Ctr);
|
XREG(35,Ctr);
|
||||||
XREG(36,Lr); /* 36 is LNK ... probably Lr ? */
|
XREG(36,Lr); /* 36 is LNK ... probably Lr ? */
|
||||||
}
|
context->ContextFlags |= CONTEXT_CONTROL;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_FLOATING_POINT)
|
if (flags & CONTEXT_FLOATING_POINT)
|
||||||
{
|
{
|
||||||
|
@ -115,6 +114,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
FREG(30);
|
FREG(30);
|
||||||
FREG(31);
|
FREG(31);
|
||||||
XREG((48+32*2),Fpscr);
|
XREG((48+32*2),Fpscr);
|
||||||
|
context->ContextFlags |= CONTEXT_FLOATING_POINT;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -201,13 +201,14 @@ static void set_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
#define FREG(x) to->Fpr##x = from->Fpr##x;
|
#define FREG(x) to->Fpr##x = from->Fpr##x;
|
||||||
#define CREG(x) to->x = from->x;
|
#define CREG(x) to->x = from->x;
|
||||||
/* copy a context structure according to the flags */
|
/* copy a context structure according to the flags */
|
||||||
static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
static void copy_context( CONTEXT *to, const CONTEXT *from, unsigned int flags )
|
||||||
{
|
{
|
||||||
if (flags & CONTEXT_CONTROL)
|
if (flags & CONTEXT_CONTROL)
|
||||||
{
|
{
|
||||||
CREG(Msr);
|
CREG(Msr);
|
||||||
CREG(Ctr);
|
CREG(Ctr);
|
||||||
CREG(Iar);
|
CREG(Iar);
|
||||||
|
to->ContextFlags |= CONTEXT_CONTROL;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_INTEGER)
|
if (flags & CONTEXT_INTEGER)
|
||||||
{
|
{
|
||||||
|
@ -218,6 +219,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
||||||
IREG(26); IREG(27); IREG(28); IREG(29); IREG(30); IREG(31);
|
IREG(26); IREG(27); IREG(28); IREG(29); IREG(30); IREG(31);
|
||||||
CREG(Xer);
|
CREG(Xer);
|
||||||
CREG(Cr);
|
CREG(Cr);
|
||||||
|
to->ContextFlags |= CONTEXT_INTEGER;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_FLOATING_POINT)
|
if (flags & CONTEXT_FLOATING_POINT)
|
||||||
{
|
{
|
||||||
|
@ -254,6 +256,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
||||||
FREG(30);
|
FREG(30);
|
||||||
FREG(31);
|
FREG(31);
|
||||||
CREG(Fpscr);
|
CREG(Fpscr);
|
||||||
|
to->ContextFlags |= CONTEXT_FLOATING_POINT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
context->wim = 0; /* FIXME */
|
context->wim = 0; /* FIXME */
|
||||||
context->tbr = 0; /* FIXME */
|
context->tbr = 0; /* FIXME */
|
||||||
}
|
}
|
||||||
|
context |= flags & (CONTEXT_CONTROL|CONTEXT_INTEGER);
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_FLOATING_POINT)
|
if (flags & CONTEXT_FLOATING_POINT)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +106,7 @@ static void set_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
|
|
||||||
|
|
||||||
/* copy a context structure according to the flags */
|
/* copy a context structure according to the flags */
|
||||||
static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
static void copy_context( CONTEXT *to, const CONTEXT *from, unsigned int flags )
|
||||||
{
|
{
|
||||||
if (flags & CONTEXT_CONTROL)
|
if (flags & CONTEXT_CONTROL)
|
||||||
{
|
{
|
||||||
|
@ -155,6 +156,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
||||||
{
|
{
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
}
|
}
|
||||||
|
context |= flags & (CONTEXT_CONTROL|CONTEXT_INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve the current instruction pointer of a thread */
|
/* retrieve the current instruction pointer of a thread */
|
||||||
|
@ -187,6 +189,7 @@ int tkill( int pid, int sig )
|
||||||
/* retrieve the thread context */
|
/* retrieve the thread context */
|
||||||
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
|
context->ContextFlags |= CONTEXT_SPARC;
|
||||||
flags &= ~CONTEXT_SPARC; /* get rid of CPU id */
|
flags &= ~CONTEXT_SPARC; /* get rid of CPU id */
|
||||||
|
|
||||||
if (thread->context) /* thread is inside an exception event or suspended */
|
if (thread->context) /* thread is inside an exception event or suspended */
|
||||||
|
|
|
@ -106,6 +106,7 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
context->SegFs = regs.fs;
|
context->SegFs = regs.fs;
|
||||||
context->SegGs = regs.gs;
|
context->SegGs = regs.gs;
|
||||||
}
|
}
|
||||||
|
context->ContextFlags |= flags & CONTEXT_FULL;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_DEBUG_REGISTERS)
|
if (flags & CONTEXT_DEBUG_REGISTERS)
|
||||||
{
|
{
|
||||||
|
@ -115,12 +116,14 @@ static void get_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
if (get_debug_reg( pid, 3, &context->Dr3 ) == -1) goto error;
|
if (get_debug_reg( pid, 3, &context->Dr3 ) == -1) goto error;
|
||||||
if (get_debug_reg( pid, 6, &context->Dr6 ) == -1) goto error;
|
if (get_debug_reg( pid, 6, &context->Dr6 ) == -1) goto error;
|
||||||
if (get_debug_reg( pid, 7, &context->Dr7 ) == -1) goto error;
|
if (get_debug_reg( pid, 7, &context->Dr7 ) == -1) goto error;
|
||||||
|
context->ContextFlags |= CONTEXT_DEBUG_REGISTERS;
|
||||||
}
|
}
|
||||||
if (flags & CONTEXT_FLOATING_POINT)
|
if (flags & CONTEXT_FLOATING_POINT)
|
||||||
{
|
{
|
||||||
/* we can use context->FloatSave directly as it is using the */
|
/* we can use context->FloatSave directly as it is using the */
|
||||||
/* correct structure (the same as fsave/frstor) */
|
/* correct structure (the same as fsave/frstor) */
|
||||||
if (ptrace( PTRACE_GETFPREGS, pid, 0, &context->u.FltSave ) == -1) goto error;
|
if (ptrace( PTRACE_GETFPREGS, pid, 0, &context->u.FltSave ) == -1) goto error;
|
||||||
|
context->ContextFlags |= CONTEXT_FLOATING_POINT;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
@ -200,7 +203,7 @@ static void set_thread_context_ptrace( struct thread *thread, unsigned int flags
|
||||||
|
|
||||||
|
|
||||||
/* copy a context structure according to the flags */
|
/* copy a context structure according to the flags */
|
||||||
static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
static void copy_context( CONTEXT *to, const CONTEXT *from, unsigned int flags )
|
||||||
{
|
{
|
||||||
if (flags & CONTEXT_CONTROL)
|
if (flags & CONTEXT_CONTROL)
|
||||||
{
|
{
|
||||||
|
@ -242,6 +245,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
||||||
}
|
}
|
||||||
/* we don't bother copying the debug registers, since they */
|
/* we don't bother copying the debug registers, since they */
|
||||||
/* always need to be accessed by ptrace anyway */
|
/* always need to be accessed by ptrace anyway */
|
||||||
|
to->ContextFlags |= flags & ~CONTEXT_DEBUG_REGISTERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve the current instruction pointer of a thread */
|
/* retrieve the current instruction pointer of a thread */
|
||||||
|
@ -285,6 +289,7 @@ int tkill( int pid, int sig )
|
||||||
/* retrieve the thread context */
|
/* retrieve the thread context */
|
||||||
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
|
||||||
{
|
{
|
||||||
|
context->ContextFlags |= CONTEXT_AMD64;
|
||||||
flags &= ~CONTEXT_AMD64; /* get rid of CPU id */
|
flags &= ~CONTEXT_AMD64; /* get rid of CPU id */
|
||||||
|
|
||||||
if (thread->context) /* thread is inside an exception event or suspended */
|
if (thread->context) /* thread is inside an exception event or suspended */
|
||||||
|
|
Loading…
Reference in New Issue