summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2001-11-05 22:26:57 +0000
committerdrahn <drahn@openbsd.org>2001-11-05 22:26:57 +0000
commit385f52ed0b774e2c2a33c13489e2eb2e84b42acc (patch)
tree9ece8a5e48ccd8850e90fdec57df8d5f99c1e77f
parentNo need to include vm/vm_param.h here, sys/sysctl.h does that for us. (diff)
downloadwireguard-openbsd-385f52ed0b774e2c2a33c13489e2eb2e84b42acc.tar.xz
wireguard-openbsd-385f52ed0b774e2c2a33c13489e2eb2e84b42acc.zip
Workaround to prevent Altivec Unavilable problem.
Why did Motorola put this exception misaligned with respect to all other exceptions? Altivec is not supported. This will cause any process executing altivec instructions to recieve an illegal instruction signal.
-rw-r--r--sys/arch/macppc/macppc/machdep.c15
-rw-r--r--sys/arch/powerpc/powerpc/trap.c10
2 files changed, 22 insertions, 3 deletions
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index 3fde3768caf..ec843d7ad35 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.9 2001/09/28 04:13:12 drahn Exp $ */
+/* $OpenBSD: machdep.c,v 1.10 2001/11/05 22:26:57 drahn Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -264,7 +264,7 @@ where = 3;
/*
* Set up trap vectors
*/
- for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100)
+ for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100) {
switch (exc) {
default:
bcopy(&trapcode, (void *)exc, (size_t)&trapsize);
@@ -309,6 +309,17 @@ where = 3;
#endif
break;
}
+ }
+
+ /* Grr, ALTIVEC_UNAVAIL is a vector not ~0xff aligned: 0x0f20 */
+ bcopy(&trapcode, (void *)0xf20, (size_t)&trapsize);
+ /*
+ * since trapsize is > 0x20, we just overwrote the EXC_PERF handler
+ * since we do not use it, we will "share" it with the EXC_VEC,
+ * we dont support EXC_VEC either.
+ * should be a 'ba 0xf20 written' at address 0xf00, but we
+ * do not generate EXC_PERF exceptions...
+ */
syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 5cad508fb23..d5778172955 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.33 2001/09/20 13:46:04 drahn Exp $ */
+/* $OpenBSD: trap.c,v 1.34 2001/11/05 22:26:57 drahn Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -413,6 +413,14 @@ for (i = 0; i < errnum; i++) {
break;
}
+ /* This is not really a perf exception, but is an ALTIVEC unavail
+ * which we do not handle, kill the process with illegal instruction.
+ */
+ case EXC_PERF|EXC_USER:
+ sv.sival_int = frame->srr0;
+ trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
+ break;
+
case EXC_AST|EXC_USER:
/* This is just here that we trap */
break;