Fix a few more bugs.
This commit is contained in:
parent
9872e4c410
commit
112afe4fa4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fpu.c,v 1.13 2001/09/22 19:58:28 eeh Exp $ */
|
||||
/* $NetBSD: fpu.c,v 1.14 2002/01/19 03:02:34 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -136,6 +136,7 @@ fpu_cleanup(p, fs)
|
|||
break;
|
||||
|
||||
case FSR_TT_IEEE:
|
||||
DPRINTF(FPE_INSN, ("fpu_cleanup: FSR_TT_IEEE\n"));
|
||||
/* XXX missing trap address! */
|
||||
if ((i = fsr & FSR_CX) == 0)
|
||||
panic("fpu ieee trap, but no exception");
|
||||
|
@ -143,6 +144,7 @@ fpu_cleanup(p, fs)
|
|||
break; /* XXX should return, but queue remains */
|
||||
|
||||
case FSR_TT_UNFIN:
|
||||
DPRINTF(FPE_INSN, ("fpu_cleanup: FSR_TT_UNFIN\n"));
|
||||
#ifdef SUN4U
|
||||
if (fs->fs_qsize == 0) {
|
||||
printf("fpu_cleanup: unfinished fpop");
|
||||
|
@ -153,6 +155,7 @@ fpu_cleanup(p, fs)
|
|||
|
||||
#endif /* SUN4U */
|
||||
case FSR_TT_UNIMP:
|
||||
DPRINTF(FPE_INSN, ("fpu_cleanup: FSR_TT_UNIMP\n"));
|
||||
if (fs->fs_qsize == 0)
|
||||
panic("fpu_cleanup: unimplemented fpop");
|
||||
break;
|
||||
|
@ -162,6 +165,7 @@ fpu_cleanup(p, fs)
|
|||
/* NOTREACHED */
|
||||
|
||||
case FSR_TT_HWERR:
|
||||
DPRINTF(FPE_INSN, ("fpu_cleanup: FSR_TT_HWERR\n"));
|
||||
log(LOG_ERR, "fpu hardware error (%s[%d])\n",
|
||||
p->p_comm, p->p_pid);
|
||||
uprintf("%s[%d]: fpu hardware error\n", p->p_comm, p->p_pid);
|
||||
|
@ -287,6 +291,12 @@ fpu_execute(fe, instr)
|
|||
#endif /* SUN4U */
|
||||
u_int space[4];
|
||||
|
||||
#if defined(DEBUG) && defined(DDB)
|
||||
if (fpe_debug & FPE_INSN) {
|
||||
disasem_instr(0, instr.i_int, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* `Decode' and execute instruction. Start with no exceptions.
|
||||
* The type of any i_opf opcode is in the bottom two bits, so we
|
||||
|
@ -545,19 +555,32 @@ fpu_execute(fe, instr)
|
|||
break;
|
||||
|
||||
case FTOX >> 2:
|
||||
DPRINTF(FPE_INSN, ("fpu_execute: FTOx\n"));
|
||||
DPRINTF(FPE_INSN, ("fpu_execute: FTOX\n"));
|
||||
fpu_explode(fe, fp = &fe->fe_f1, type, rs2);
|
||||
type = FTYPE_LNG;
|
||||
/* Recalculate destination register */
|
||||
rd = instr.i_opf.i_rd;
|
||||
break;
|
||||
#endif /* SUN4U */
|
||||
|
||||
#endif /* SUN4U */
|
||||
case FTOI >> 2:
|
||||
DPRINTF(FPE_INSN, ("fpu_execute: FTOI\n"));
|
||||
fpu_explode(fe, fp = &fe->fe_f1, type, rs2);
|
||||
type = FTYPE_INT;
|
||||
/* Recalculate destination register */
|
||||
rd = instr.i_opf.i_rd;
|
||||
break;
|
||||
|
||||
case FTOS >> 2:
|
||||
case FTOD >> 2:
|
||||
case FTOQ >> 2:
|
||||
DPRINTF(FPE_INSN, ("fpu_execute: FTOx\n"));
|
||||
fpu_explode(fe, fp = &fe->fe_f1, type, rs2);
|
||||
/* Recalculate rd with correct type info. */
|
||||
type = opf & 3; /* sneaky; depends on instruction encoding */
|
||||
mask = 0x3 >> (3 - type);
|
||||
rd = instr.i_opf.i_rd;
|
||||
rd = (rd & ~mask) | ((rd & mask & 0x1) << 5);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -582,6 +605,12 @@ fpu_execute(fe, instr)
|
|||
fsr |= (cx << FSR_CX_SHIFT) | (cx << FSR_AX_SHIFT);
|
||||
}
|
||||
fs->fs_fsr = fsr;
|
||||
DPRINTF(FPE_REG, ("-> %c%d\n", (type == FTYPE_LNG) ? 'x' :
|
||||
((type == FTYPE_INT) ? 'i' :
|
||||
((type == FTYPE_SNG) ? 's' :
|
||||
((type == FTYPE_DBL) ? 'd' :
|
||||
((type == FTYPE_EXT) ? 'q' : '?')))),
|
||||
rd));
|
||||
fs->fs_regs[rd] = space[0];
|
||||
if (type >= FTYPE_DBL || type == FTYPE_LNG) {
|
||||
fs->fs_regs[rd + 1] = space[1];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fpu_explode.c,v 1.6 2001/12/04 00:05:04 darrenr Exp $ */
|
||||
/* $NetBSD: fpu_explode.c,v 1.7 2002/01/19 03:02:34 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -307,6 +307,12 @@ fpu_explode(fe, fp, type, reg)
|
|||
((type == FTYPE_DBL) ? 'd' :
|
||||
((type == FTYPE_EXT) ? 'q' : '?')))),
|
||||
reg));
|
||||
#ifdef DEBUG
|
||||
if (fpe_debug & FPE_REG) {
|
||||
if (type == FTYPE_INT) printf("%d ", s);
|
||||
if (type == FTYPE_LNG) printf("%ld ", l);
|
||||
}
|
||||
#endif
|
||||
DUMPFPN(FPE_REG, fp);
|
||||
DPRINTF(FPE_REG, ("\n"));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fpu_implode.c,v 1.9 2001/12/04 00:05:05 darrenr Exp $ */
|
||||
/* $NetBSD: fpu_implode.c,v 1.10 2002/01/19 03:02:34 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -279,7 +279,9 @@ fpu_ftox(fe, fp, res)
|
|||
i = ((u_int64_t)fp->fp_mant[2]<<32)|fp->fp_mant[3];
|
||||
if (i >= ((u_int64_t)0x8000000000000000LL + sign))
|
||||
break;
|
||||
return (sign ? -i : i);
|
||||
if (sign) i = -i;
|
||||
res[1] = (int)i;
|
||||
return (i>>32);
|
||||
|
||||
default: /* Inf, qNaN, sNaN */
|
||||
break;
|
||||
|
@ -507,6 +509,10 @@ fpu_implode(fe, fp, type, space)
|
|||
register u_int *space;
|
||||
{
|
||||
|
||||
DPRINTF(FPE_REG, ("\n imploding: "));
|
||||
DUMPFPN(FPE_REG, fp);
|
||||
DPRINTF(FPE_REG, ("\n"));
|
||||
|
||||
switch (type) {
|
||||
|
||||
#ifdef SUN4U
|
||||
|
|
Loading…
Reference in New Issue