Module Name:    src
Committed By:   isaki
Date:           Sat Dec 28 11:15:11 UTC 2024

Modified Files:
        src/sys/arch/m68k/fpe: fpu_emulate.c

Log Message:
m68k/fpe: Two bugfixes in test_cc().
- Don't clear the exception byte in FPSR.
  According to the manual, all bits except BSUN are "not affected".
- Accumulate AIOP bit always.
  XXX Need to look this again later. brcc() looks to have similar one.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/m68k/fpe/fpu_emulate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.44 src/sys/arch/m68k/fpe/fpu_emulate.c:1.45
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.44	Sat Dec 28 11:09:43 2024
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Sat Dec 28 11:15:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.44 2024/12/28 11:09:43 isaki Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.45 2024/12/28 11:15:11 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.44 2024/12/28 11:09:43 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.45 2024/12/28 11:15:11 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -918,7 +918,6 @@ test_cc(struct fpemu *fe, int pred)
 
 	fpsr = fe->fe_fpsr;
 	invert = 0;
-	fpsr &= ~FPSR_EXCP;		/* clear all exceptions */
 	DPRINTF(("%s: fpsr=0x%08x\n", __func__, fpsr));
 	pred &= 0x3f;		/* lowest 6 bits */
 
@@ -990,6 +989,10 @@ test_cc(struct fpemu *fe, int pred)
 	if (sig_bsun && (fpsr & FPSR_NAN)) {
 		fpsr |= FPSR_BSUN;
 	}
+	/* if BSUN is set, IOP is set too */
+	if ((fpsr & FPSR_BSUN)) {
+		fpsr |= FPSR_AIOP;
+	}
 
 	/* put fpsr back */
 	fe->fe_fpframe->fpf_fpsr = fe->fe_fpsr = fpsr;

Reply via email to