diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-05-02 21:45:15 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-05-02 21:45:15 +0000 |
commit | fe701d386a71314959b17e471dcd9ec44af9bb52 (patch) | |
tree | 9bcc0f62b969447d598355d2cf7146375f2be340 /sys | |
parent | 74178fc77559c4b0761051dc420b658feaaf10bb (diff) |
Check for a disabled FPU before attempting to emulate the instruction.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/m88k/m88k/m88110_fp.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/sys/arch/m88k/m88k/m88110_fp.c b/sys/arch/m88k/m88k/m88110_fp.c index ae9c87815c6..ac0d80b3fab 100644 --- a/sys/arch/m88k/m88k/m88110_fp.c +++ b/sys/arch/m88k/m88k/m88110_fp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110_fp.c,v 1.1 2007/12/29 17:41:34 miod Exp $ */ +/* $OpenBSD: m88110_fp.c,v 1.2 2008/05/02 21:45:14 miod Exp $ */ /* * Copyright (c) 2007, Miodrag Vallat. @@ -164,8 +164,14 @@ m88110_fpu_exception(struct trapframe *frame) goto deliver; case 0x21: /* - * ``real'' FPU instruction. We'll try to emulate it. + * ``real'' FPU instruction. We'll try to emulate it, + * unless FPU is disabled. */ + if (frame->tf_epsr & PSR_SFD1) { /* don't bother */ + sig = SIGFPE; + fault_type = FPE_FLTINV; + goto deliver; + } sig = fpu_emulate(frame, insn); fault_type = SI_NOINFO; /* @@ -184,12 +190,6 @@ m88110_fpu_exception(struct trapframe *frame) goto deliver; } - if (frame->tf_epsr & PSR_SFD1) { /* don't bother */ - sig = SIGFPE; - fault_type = FPE_FLTINV; - goto deliver; - } - if (sig != 0) { if (sig == SIGILL) fault_type = ILL_ILLOPC; @@ -509,6 +509,7 @@ do_int: fpu_fetch(frame, rs2, t2, t2, &dest); fpu_store(frame, rd, t2, FTYPE_INT, &dest); break; + case 0x0a: /* nint */ /* round to nearest */ frame->tf_fpcr = (old_fpcr & ~(FPCR_RD_MASK << FPCR_RD_SHIFT)) | @@ -575,16 +576,6 @@ do_int: * * If either operand is NaN, the result is unordered. This causes an * reserved operand exception (except for nonsignalling NaNs for fcmpu). - * - * Everything else is ordered: - * |Inf| > |numbers| > |0|. - * We already arranged for fp_class(Inf) > fp_class(numbers) > fp_class(0), - * so we get this directly. Note, however, that two zeros compare equal - * regardless of sign, while everything else depends on sign. - * - * Incidentally, two Infs of the same sign compare equal. Since the 88110 - * does infinity arithmetic on hardware, this codepath should never be - * entered. */ void fpu_compare(struct trapframe *frame, fparg *s1, fparg *s2, u_int width, |