svn commit: r204496 - stable/8/sys/powerpc/aim
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Mon Mar 1 00:38:21 UTC 2010
Author: nwhitehorn
Date: Mon Mar 1 00:38:20 2010
New Revision: 204496
URL: http://svn.freebsd.org/changeset/base/204496
Log:
MFC r204197:
Allow user programs to execute mfpvr instructions. Linux allows this, and
some math-related software like GMP expects to be able to use it to pick
a target appropriately.
Reported by: Jakob van Santen <vansanten at wisc dot edu>
Modified:
stable/8/sys/powerpc/aim/trap.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
stable/8/sys/netinet/ (props changed)
Modified: stable/8/sys/powerpc/aim/trap.c
==============================================================================
--- stable/8/sys/powerpc/aim/trap.c Mon Mar 1 00:35:30 2010 (r204495)
+++ stable/8/sys/powerpc/aim/trap.c Mon Mar 1 00:38:20 2010 (r204496)
@@ -82,6 +82,7 @@ static void printtrap(u_int vector, stru
int user);
static int trap_pfault(struct trapframe *frame, int user);
static int fix_unaligned(struct thread *td, struct trapframe *frame);
+static int ppc_instr_emulate(struct trapframe *frame);
static int handle_onfault(struct trapframe *frame);
static void syscall(struct trapframe *frame);
@@ -211,7 +212,9 @@ trap(struct trapframe *frame)
/* Identify the trap reason */
if (frame->srr1 & EXC_PGM_TRAP)
sig = SIGTRAP;
- else
+ else if (ppc_instr_emulate(frame) == 0)
+ frame->srr0 += 4;
+ else
sig = SIGILL;
break;
@@ -632,3 +635,21 @@ fix_unaligned(struct thread *td, struct
return -1;
}
+
+static int
+ppc_instr_emulate(struct trapframe *frame)
+{
+ uint32_t instr;
+ int reg;
+
+ instr = fuword32((void *)frame->srr0);
+
+ if ((instr & 0xfc1fffff) == 0x7c1f42a6) { /* mfpvr */
+ reg = (instr & ~0xfc1fffff) >> 21;
+ frame->fixreg[reg] = mfpvr();
+ return (0);
+ }
+
+ return (-1);
+}
+
More information about the svn-src-stable-8
mailing list