Use Iar (Instruction Address Register) instead of Fill[0].
siginfo.si_code uses the lower 16bit for the type of the exception.
This commit is contained in:
parent
12b901109d
commit
c87c2c4f1a
|
@ -49,7 +49,7 @@ typedef struct
|
|||
#elif defined(__sparc__)
|
||||
# define GET_IP(context) ((LPVOID)(context)->pc)
|
||||
#elif defined(__powerpc__)
|
||||
# define GET_IP(context) ((LPVOID)(context)->Fill[0])
|
||||
# define GET_IP(context) ((LPVOID)(context)->Iar)
|
||||
#else
|
||||
# error You must define GET_IP for this CPU
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,7 @@ typedef struct ucontext SIGCONTEXT;
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(seh);
|
||||
|
||||
typedef int (*wine_signal_handler)(unsigned sig);
|
||||
typedef int (*wine_signal_handler)(unsigned int sig);
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
|
@ -86,7 +86,7 @@ static sigset_t all_sigs;
|
|||
/***********************************************************************
|
||||
* dispatch_signal
|
||||
*/
|
||||
inline static int dispatch_signal(unsigned sig)
|
||||
inline static int dispatch_signal(unsigned int sig)
|
||||
{
|
||||
if (handlers[sig] == NULL) return 0;
|
||||
return handlers[sig](sig);
|
||||
|
@ -106,7 +106,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
|
|||
C(21); C(22); C(23); C(24); C(25); C(26); C(27); C(28); C(29); C(30);
|
||||
C(31);
|
||||
|
||||
CX(Fill[0],nip);
|
||||
CX(Iar,nip);
|
||||
CX(Msr,msr);
|
||||
CX(Ctr,ctr);
|
||||
#undef CX
|
||||
|
@ -139,7 +139,7 @@ static void restore_context( const CONTEXT *context, SIGCONTEXT *sigcontext )
|
|||
C(21); C(22); C(23); C(24); C(25); C(26); C(27); C(28); C(29); C(30);
|
||||
C(31);
|
||||
|
||||
CX(Fill[0],nip);
|
||||
CX(Iar,nip);
|
||||
CX(Msr,msr);
|
||||
CX(Ctr,ctr);
|
||||
#undef CX
|
||||
|
@ -222,7 +222,7 @@ static HANDLER_DEF(segv_handler)
|
|||
rec.NumberParameters = 0;
|
||||
switch (__siginfo->si_signo) {
|
||||
case SIGSEGV:
|
||||
switch (__siginfo->si_code) {
|
||||
switch ( __siginfo->si_code & 0xffff ) {
|
||||
case SEGV_MAPERR:
|
||||
case SEGV_ACCERR:
|
||||
rec.NumberParameters = 2;
|
||||
|
@ -237,7 +237,7 @@ static HANDLER_DEF(segv_handler)
|
|||
}
|
||||
break;
|
||||
case SIGBUS:
|
||||
switch (__siginfo->si_code) {
|
||||
switch ( __siginfo->si_code & 0xffff ) {
|
||||
case BUS_ADRALN:
|
||||
rec.ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT;
|
||||
break;
|
||||
|
@ -256,7 +256,7 @@ static HANDLER_DEF(segv_handler)
|
|||
}
|
||||
break;
|
||||
case SIGILL:
|
||||
switch (__siginfo->si_code) {
|
||||
switch ( __siginfo->si_code & 0xffff ) {
|
||||
case ILL_ILLOPC: /* illegal opcode */
|
||||
case ILL_ILLOPN: /* illegal operand */
|
||||
case ILL_ILLADR: /* illegal addressing mode */
|
||||
|
@ -298,7 +298,7 @@ static HANDLER_DEF(trap_handler)
|
|||
rec.NumberParameters = 0;
|
||||
|
||||
/* FIXME: check if we might need to modify PC */
|
||||
switch (__siginfo->si_code) {
|
||||
switch (__siginfo->si_code & 0xffff) {
|
||||
case TRAP_BRKPT:
|
||||
rec.ExceptionCode = EXCEPTION_BREAKPOINT;
|
||||
break;
|
||||
|
@ -324,7 +324,7 @@ static HANDLER_DEF(fpe_handler)
|
|||
/*save_fpu( &context, HANDLER_CONTEXT );*/
|
||||
save_context( &context, HANDLER_CONTEXT );
|
||||
|
||||
switch ( __siginfo->si_code ) {
|
||||
switch ( __siginfo->si_code & 0xffff ) {
|
||||
case FPE_FLTSUB:
|
||||
rec.ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
|
||||
break;
|
||||
|
@ -377,7 +377,7 @@ static HANDLER_DEF(int_handler)
|
|||
rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
||||
rec.ExceptionRecord = NULL;
|
||||
rec.ExceptionAddress = (LPVOID)context.Fill[0];
|
||||
rec.ExceptionAddress = (LPVOID)context.Iar;
|
||||
rec.NumberParameters = 0;
|
||||
EXC_RtlRaiseException( &rec, &context );
|
||||
restore_context( &context, HANDLER_CONTEXT );
|
||||
|
@ -411,7 +411,7 @@ static int set_handler( int sig, int have_sigaltstack, void (*func)() )
|
|||
/***********************************************************************
|
||||
* __wine_set_signal_handler (NTDLL.@)
|
||||
*/
|
||||
int __wine_set_signal_handler(unsigned sig, wine_signal_handler wsh)
|
||||
int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
|
||||
{
|
||||
if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1;
|
||||
if (handlers[sig] != NULL) return -2;
|
||||
|
|
|
@ -959,7 +959,7 @@ typedef struct
|
|||
|
||||
/* These are selected by CONTEXT_CONTROL */
|
||||
DWORD Msr;
|
||||
DWORD Iar;
|
||||
DWORD Iar; /* Instruction Address Register , aka PC ... */
|
||||
DWORD Lr;
|
||||
DWORD Ctr;
|
||||
|
||||
|
|
|
@ -56,18 +56,13 @@ static void get_thread_context( struct thread *thread, unsigned int flags, CONTE
|
|||
#undef IREG
|
||||
XREG(37,Xer);
|
||||
XREG(38,Cr);
|
||||
|
||||
}
|
||||
if (flags & CONTEXT_CONTROL)
|
||||
{
|
||||
XREG(32,Iar);
|
||||
XREG(33,Msr);
|
||||
XREG(35,Ctr);
|
||||
|
||||
XREG(32,Fill[0]); /* misused for PC / nip */
|
||||
|
||||
/* what is Iar? Lr? */
|
||||
/*XREG(33*4,Iar);*/
|
||||
/*XREG(33*4,Lr);*/
|
||||
XREG(36,Lr); /* 36 is LNK ... probably Lr ? */
|
||||
}
|
||||
}
|
||||
if (flags & CONTEXT_FLOATING_POINT)
|
||||
|
@ -137,14 +132,10 @@ static void set_thread_context( struct thread *thread, unsigned int flags, const
|
|||
}
|
||||
if (flags & CONTEXT_CONTROL)
|
||||
{
|
||||
XREG(32,Iar);
|
||||
XREG(33,Msr);
|
||||
XREG(35,Ctr);
|
||||
|
||||
XREG(32,Fill[0]); /* misused for PC / nip */
|
||||
|
||||
/* what is Iar? Lr? */
|
||||
/*XREG(33*4,Iar);*/
|
||||
/*XREG(33*4,Lr);*/
|
||||
XREG(36,Lr);
|
||||
}
|
||||
}
|
||||
if (flags & CONTEXT_FLOATING_POINT)
|
||||
|
@ -202,7 +193,7 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
|||
{
|
||||
CREG(Msr);
|
||||
CREG(Ctr);
|
||||
CREG(Fill[0]);
|
||||
CREG(Iar);
|
||||
}
|
||||
if (flags & CONTEXT_INTEGER)
|
||||
{
|
||||
|
@ -256,13 +247,13 @@ static void copy_context( CONTEXT *to, const CONTEXT *from, int flags )
|
|||
void *get_thread_ip( struct thread *thread )
|
||||
{
|
||||
CONTEXT context;
|
||||
context.Fill[0] = 0;
|
||||
context.Iar = 0;
|
||||
if (suspend_for_ptrace( thread ))
|
||||
{
|
||||
get_thread_context( thread, CONTEXT_CONTROL, &context );
|
||||
resume_thread( thread );
|
||||
}
|
||||
return (void *)context.Fill[0];
|
||||
return (void *)context.Iar;
|
||||
}
|
||||
|
||||
/* determine if we should continue the thread in single-step mode */
|
||||
|
|
Loading…
Reference in New Issue