PERFORCE change 135859 for review

Marcel Moolenaar marcel at FreeBSD.org
Thu Feb 21 00:44:58 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=135859

Change 135859 by marcel at marcel_xcllnt on 2008/02/21 00:43:57

	Call the FPU emulator when we get an EXC_PGM.
	This makes a hard float work on E500. The
	overhead is about 4% utilization when 
	running top(1).
	Reserve space for the FP registers on Book-E
	as well and account for the increased PCB
	size in locore.S
	
	In machdep.c, include opt_kstack_pages.h.

Affected files ...

.. //depot/projects/e500/sys/powerpc/booke/locore.S#4 edit
.. //depot/projects/e500/sys/powerpc/booke/machdep.c#9 edit
.. //depot/projects/e500/sys/powerpc/booke/trap.c#3 edit
.. //depot/projects/e500/sys/powerpc/include/pcb.h#3 edit

Differences ...

==== //depot/projects/e500/sys/powerpc/booke/locore.S#4 (text+ko) ====

@@ -257,7 +257,7 @@
  */
 	lis	%r1, kstack0_space at ha
 	addi	%r1, %r1, kstack0_space at l
-	addi	%r1, %r1, (16384 - 256)
+	addi	%r1, %r1, (16384 - 512)
 
 /*
  * Intialise exception vector offsets

==== //depot/projects/e500/sys/powerpc/booke/machdep.c#9 (text+ko) ====

@@ -84,6 +84,7 @@
 __FBSDID("$FreeBSD: src/sys/powerpc/powerpc/machdep.c,v 1.89.2.1 2005/08/08 07:02:12 grehan Exp $");
 
 #include "opt_compat.h"
+#include "opt_kstack_pages.h"
 
 #include <sys/cdefs.h>
 #include <sys/types.h>

==== //depot/projects/e500/sys/powerpc/booke/trap.c#3 (text+ko) ====

@@ -34,6 +34,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/powerpc/powerpc/trap.c,v 1.54.2.1 2005/08/08 07:02:12 grehan Exp $");
 
+#include "opt_fpu_emu.h"
 #include "opt_ktrace.h"
 
 #include <sys/param.h>
@@ -74,6 +75,10 @@
 #include <machine/trap.h>
 #include <machine/spr.h>
 
+#ifdef FPU_EMU
+#include <powerpc/fpu/fpu_extern.h>
+#endif
+
 void		trap(struct trapframe *);
 
 static void	trap_fatal(struct trapframe *frame);
@@ -179,9 +184,17 @@
 		case EXC_DEBUG:	/* Single stepping */
 			mtspr(SPR_DBSR, mfspr(SPR_DBSR));
 			frame->srr1 &= ~PSL_DE;
-			/*FALLTHROUGH*/
-		case EXC_PGM:	/* GDB breakpoint */
+			sig = SIGTRAP;
+			break;
+
+		case EXC_PGM:	/* Program exception */
+#ifdef FPU_EMU
+			sig = fpu_emulate(frame,
+			    (struct fpreg *)&td->td_pcb->pcb_fpu);
+#else
+			/* XXX SIGILL for non-trap instructions. */
 			sig = SIGTRAP;
+#endif
 			break;
 
 		default:

==== //depot/projects/e500/sys/powerpc/include/pcb.h#3 (text+ko) ====

@@ -70,7 +70,6 @@
 	faultbuf	*pcb_onfault;		/* For use during
 						    copyin/copyout */
 	int		pcb_flags;
-#if defined(AIM)
 #define	PCB_FPU		1	/* Process had FPU initialized */
 	struct fpu {
 		double	fpr[32];
@@ -78,7 +77,6 @@
 	} pcb_fpu;		/* Floating point processor */
 	unsigned int	pcb_fpcpu;		/* which CPU had our FPU
 							stuff. */
-#endif
 };
 
 #ifdef	_KERNEL


More information about the p4-projects mailing list