Commit c87c2c4f authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Use Iar (Instruction Address Register) instead of Fill[0].

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