svn commit: r191261 - in head/sys/powerpc: aim include
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Apr 19 06:30:01 UTC 2009
Author: nwhitehorn
Date: Sun Apr 19 06:30:00 2009
New Revision: 191261
URL: http://svn.freebsd.org/changeset/base/191261
Log:
Fix a typo in the SRR1 comparison for program exceptions. While here,
replace magic numbers with constants to keep this from happening again.
Without this fix, some programs would occasionally get SIGTRAP instead
of SIGILL on an illegal instruction. This affected Altivec detection
in pixman, and possibly other software.
Reported by: Andreas Tobler
MFC after: 1 week
Modified:
head/sys/powerpc/aim/trap.c
head/sys/powerpc/include/trap_aim.h
Modified: head/sys/powerpc/aim/trap.c
==============================================================================
--- head/sys/powerpc/aim/trap.c Sun Apr 19 05:34:07 2009 (r191260)
+++ head/sys/powerpc/aim/trap.c Sun Apr 19 06:30:00 2009 (r191261)
@@ -208,9 +208,8 @@ trap(struct trapframe *frame)
break;
case EXC_PGM:
- /* XXX temporarily */
- /* XXX: Magic Number? */
- if (frame->srr1 & 0x0002000)
+ /* Identify the trap reason */
+ if (frame->srr1 & EXC_PGM_TRAP)
sig = SIGTRAP;
else
sig = SIGILL;
Modified: head/sys/powerpc/include/trap_aim.h
==============================================================================
--- head/sys/powerpc/include/trap_aim.h Sun Apr 19 05:34:07 2009 (r191260)
+++ head/sys/powerpc/include/trap_aim.h Sun Apr 19 06:30:00 2009 (r191261)
@@ -103,4 +103,15 @@
#define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */
#define EXC_ALI_RA(dsisr) (dsisr & 0x1f)
+/*
+ * SRR1 bits for program exception traps. These identify what caused
+ * the program exception. See section 6.5.9 of the Power ISA Version
+ * 2.05.
+ */
+
+#define EXC_PGM_FPENABLED (1UL << 20)
+#define EXC_PGM_ILLEGAL (1UL << 19)
+#define EXC_PGM_PRIV (1UL << 18)
+#define EXC_PGM_TRAP (1UL << 17)
+
#endif /* _POWERPC_TRAP_H_ */
More information about the svn-src-all
mailing list