From owner-svn-src-all@FreeBSD.ORG Sun Apr 19 06:30:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53471106566B; Sun, 19 Apr 2009 06:30:01 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F34B8FC18; Sun, 19 Apr 2009 06:30:01 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J6U1nw001242; Sun, 19 Apr 2009 06:30:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J6U14U001240; Sun, 19 Apr 2009 06:30:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200904190630.n3J6U14U001240@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 19 Apr 2009 06:30:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191261 - in head/sys/powerpc: aim include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 06:30:01 -0000 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_ */