diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-01-01 15:04:01 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-01-01 15:04:01 +0000 |
commit | 3b9a3f52ac621c498c38c580f9342336ab41400b (patch) | |
tree | b92d73f678c9ad3ef664059e6357fa13740a1a8a /sys/arch | |
parent | c6a7948ea6d8c3cf4015065ff2fe3938900cb040 (diff) |
Make sure we grab the kernel lock before invoking trapsignal().
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/loongson/loongson/genassym.cf | 9 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/lcore_float.S | 28 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 26 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/genassym.cf | 9 |
4 files changed, 49 insertions, 23 deletions
diff --git a/sys/arch/loongson/loongson/genassym.cf b/sys/arch/loongson/loongson/genassym.cf index 4ffcdd436c7..006c31bf809 100644 --- a/sys/arch/loongson/loongson/genassym.cf +++ b/sys/arch/loongson/loongson/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.1 2009/12/09 19:38:31 miod Exp $ +# $OpenBSD: genassym.cf,v 1.2 2010/01/01 15:03:58 miod Exp $ # # Copyright (c) 1997 Per Fogelstrom / Opsycon AB # @@ -30,6 +30,7 @@ include <sys/buf.h> include <sys/proc.h> include <sys/mbuf.h> include <sys/user.h> +include <sys/siginfo.h> include <uvm/uvm.h> @@ -75,3 +76,9 @@ export PMAP_SEGTABSIZE export SEGSHIFT export CCA_CACHED + +export FPE_FLTDIV +export FPE_FLTOVF +export FPE_FLTUND +export FPE_FLTRES +export FPE_FLTINV diff --git a/sys/arch/mips64/mips64/lcore_float.S b/sys/arch/mips64/mips64/lcore_float.S index 686661ab64d..dad6f45e1b0 100644 --- a/sys/arch/mips64/mips64/lcore_float.S +++ b/sys/arch/mips64/mips64/lcore_float.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_float.S,v 1.17 2009/09/30 06:22:00 syuu Exp $ */ +/* $OpenBSD: lcore_float.S,v 1.18 2010/01/01 15:04:00 miod Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -484,27 +484,27 @@ NON_LEAF(MipsFPTrap, FRAMESZ(CF_SZ), ra) * Send a floating point exception signal to the current process. */ 3: - cfc1 a2, FPC_CSR # code = FP exceptions + cfc1 a1, FPC_CSR # code = FP exceptions GET_CPU_INFO(t2, t3) PTR_L a0, CI_CURPROC(t2) # get current process - PTR_L a4, 3*REGSZ(sp) - and v0, a2, FPC_EXCEPTION_INEXACT + PTR_L a3, 3*REGSZ(sp) + and v0, a1, FPC_EXCEPTION_INEXACT bnez v0, 4f - li a3, 6 - and v0, a2, FPC_EXCEPTION_UNDERFLOW + li a2, FPE_FLTRES + and v0, a1, FPC_EXCEPTION_UNDERFLOW bnez v0, 4f - li a3, 5 - and v0, a2, FPC_EXCEPTION_OVERFLOW + li a2, FPE_FLTUND + and v0, a1, FPC_EXCEPTION_OVERFLOW bnez v0, 4f - li a3, 4 - and v0, a2, FPC_EXCEPTION_DIV0 + li a2, FPE_FLTOVF + and v0, a1, FPC_EXCEPTION_DIV0 bnez v0, 4f - li a3, 3 - li a3, 7 # XXX FPE_FLTINV + li a2, FPE_FLTDIV + li a2, FPE_FLTINV 4: ctc1 zero, FPC_CSR # Clear exceptions - jal trapsignal - li a1, SIGFPE + jal fpu_trapsignal + nop b FPReturn nop diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index 35d33e87fcc..8e0733c2ecd 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.53 2009/12/28 06:55:27 syuu Exp $ */ +/* $OpenBSD: trap.c,v 1.54 2010/01/01 15:04:00 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -141,6 +141,7 @@ extern void MipsSwitchFPState16(struct proc *, struct trap_frame *); extern void MipsFPTrap(u_int, u_int, u_int, union sigval); void ast(void); +void fpu_trapsignal(struct proc *, u_long, int, union sigval); void trap(struct trap_frame *); #ifdef PTRACE int cpu_singlestep(struct proc *); @@ -848,6 +849,17 @@ child_return(arg) #endif } +/* + * Wrapper around trapsignal() for use by the floating point code. + */ +void +fpu_trapsignal(struct proc *p, u_long ucode, int typ, union sigval sv) +{ + KERNEL_PROC_LOCK(p); + trapsignal(p, SIGFPE, ucode, typ, sv); + KERNEL_PROC_UNLOCK(p); +} + #if defined(DDB) || defined(DEBUG) void trapDump(msg) @@ -898,16 +910,14 @@ MipsEmulateBranch(framePtr, instPC, fpcCSR, curinst) int condition; register_t *regsPtr = (register_t *)framePtr; -#define GetBranchDest(InstPtr, inst) \ - ((unsigned long)InstPtr + 4 + ((short)inst.IType.imm << 2)) +#define GetBranchDest(InstPtr, inst) \ + ((unsigned long)InstPtr + 4 + ((short)inst.IType.imm << 2)) - if (curinst) { + if (curinst) inst = *(InstFmt *)&curinst; - } - else { + else inst = *(InstFmt *)instPC; - } #if 0 printf("regsPtr=%x PC=%x Inst=%x fpcCsr=%x\n", regsPtr, instPC, inst.word, fpcCSR); /* XXX */ @@ -1023,7 +1033,9 @@ MipsEmulateBranch(framePtr, instPC, fpcCSR, curinst) default: retAddr = instPC + 4; } + return (retAddr); +#undef GetBranchDest } #ifdef PTRACE diff --git a/sys/arch/sgi/sgi/genassym.cf b/sys/arch/sgi/sgi/genassym.cf index 11a24db861c..63d59099eae 100644 --- a/sys/arch/sgi/sgi/genassym.cf +++ b/sys/arch/sgi/sgi/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.19 2009/12/07 18:58:37 miod Exp $ +# $OpenBSD: genassym.cf,v 1.20 2010/01/01 15:04:00 miod Exp $ # # Copyright (c) 1997 Per Fogelstrom / Opsycon AB # @@ -30,6 +30,7 @@ include <sys/buf.h> include <sys/proc.h> include <sys/mbuf.h> include <sys/user.h> +include <sys/siginfo.h> include <uvm/uvm.h> @@ -75,3 +76,9 @@ export PMAP_SEGTABSIZE export SEGSHIFT export CCA_CACHED + +export FPE_FLTDIV +export FPE_FLTOVF +export FPE_FLTUND +export FPE_FLTRES +export FPE_FLTINV |