PATCH: ppc fixes

Marcus Meissner meissner at suse.de
Thu Aug 29 10:01:58 CDT 2002


Hi,

Ciao, Marcus

License: LGPL
Changelog:
	Use Iar (Instruction Address Register) instead of Fill[0].
	siginfo.si_code uses the lower 16bit for the type of the
	exception.

Index: dlls/ntdll/exception.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/exception.c,v
retrieving revision 1.47
diff -u -r1.47 exception.c
--- dlls/ntdll/exception.c	17 Aug 2002 01:19:06 -0000	1.47
+++ dlls/ntdll/exception.c	29 Aug 2002 14:53:02 -0000
@@ -49,7 +49,7 @@
 #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
Index: dlls/ntdll/signal_powerpc.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/signal_powerpc.c,v
retrieving revision 1.2
diff -u -r1.2 signal_powerpc.c
--- dlls/ntdll/signal_powerpc.c	28 Aug 2002 23:42:34 -0000	1.2
+++ dlls/ntdll/signal_powerpc.c	29 Aug 2002 14:53:02 -0000
@@ -106,7 +106,7 @@
 	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 @@
 	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 @@
     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 @@
 	}
     	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 @@
 	}
     	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 @@
     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 @@
     /*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 @@
         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 );
Index: include/winnt.h
===================================================================
RCS file: /home/wine/wine/include/winnt.h,v
retrieving revision 1.119
diff -u -r1.119 winnt.h
--- include/winnt.h	26 Aug 2002 21:39:17 -0000	1.119
+++ include/winnt.h	29 Aug 2002 14:53:26 -0000
@@ -959,7 +959,7 @@
 
     /* These are selected by CONTEXT_CONTROL */
     DWORD Msr;
-    DWORD Iar;
+    DWORD Iar; /* Instruction Address Register , aka PC ... */
     DWORD Lr;
     DWORD Ctr;
 
Index: server/context_powerpc.c
===================================================================
RCS file: /home/wine/wine/server/context_powerpc.c,v
retrieving revision 1.1
diff -u -r1.1 context_powerpc.c
--- server/context_powerpc.c	17 Aug 2002 01:19:06 -0000	1.1
+++ server/context_powerpc.c	29 Aug 2002 14:53:30 -0000
@@ -56,18 +56,13 @@
 #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 @@
         }
         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 @@
     {
     	CREG(Msr);
     	CREG(Ctr);
-    	CREG(Fill[0]);
+    	CREG(Iar);
     }
     if (flags & CONTEXT_INTEGER)
     {
@@ -256,13 +247,13 @@
 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 */



More information about the wine-patches mailing list