Subject: Re: OpenBSD fix for Altivec assist exception relevant for NetBSD too?
To: None <port-powerpc@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: port-powerpc
Date: 05/02/2007 01:24:22
In article <BAY105-F37F4183226F9C5E63BDC87B7420@phx.gbl>,
David H. Gutteridge <dhgutteridge@sympatico.ca> wrote:
>Hi all,
>
>I happened across a reference to a recent fix made by OpenBSD, I
>wondered if it was relevant for NetBSD too?  The entry says "An
>unhandled AltiVec assist exception can cause a kernel panic."
>
>Link is here: http://www.openbsd.org/errata40.html#013_altivec
>
>I can see that NetBSD's trap.h already has the exception in question
>defined, but I couldn't see a reference to it in trap.c.  (Of course, I
>don't know enough to make proper sense of the code in general.)

How about this?

christos

Index: trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/powerpc/trap.c,v
retrieving revision 1.118
diff -u -u -r1.118 trap.c
--- trap.c	4 Mar 2007 06:00:38 -0000	1.118
+++ trap.c	2 May 2007 01:23:02 -0000
@@ -383,7 +383,8 @@
 			save_vec_lwp(l, ALTIVEC_SAVE);
 		enable_vec();
 		break;
-#else
+#endif
+	case EXC_VECAST|EXC_USER:
 		KERNEL_LOCK(1, l);
 		if (cpu_printfataltraps) {
 			printf("trap: pid %d.%d (%s): user VEC trap @ %#lx "
@@ -399,7 +400,7 @@
 		(*p->p_emul->e_trapsignal)(l, &ksi);
 		KERNEL_UNLOCK_LAST(l);
 		break;
-#endif
+
 	case EXC_MCHK|EXC_USER:
 		ci->ci_ev_umchk.ev_count++;
 		if (cpu_printfataltraps) {