x87: fixed C1 (rounding up) for overflow condition

This commit is contained in:
Stanislav Shwartsman 2009-04-11 17:00:28 +00:00
parent f5403c36ab
commit 024d36fa12
3 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.287 2009-04-11 14:02:13 sshwarts Exp $
// $Id: cpu.cc,v 1.288 2009-04-11 17:00:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -638,8 +638,10 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
// If debug events are not inhibited on this boundary,
// fire off a debug fault. Otherwise handle it on the next
// boundary. (becomes a trap)
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG))
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG)) {
BX_ERROR(("#DB: x86 code breakpoint catched"));
exception(BX_DB_EXCEPTION, 0, 0); // no error, not interrupt
}
}
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_pfp.cc,v 1.53 2009-03-10 21:43:11 sshwarts Exp $
// $Id: sse_pfp.cc,v 1.54 2009-04-11 17:00:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -32,6 +32,7 @@
void BX_CPU_C::check_exceptionsSSE(int exceptions_flags)
{
exceptions_flags &= 0x3F;
int unmasked = ~(MXCSR.get_exceptions_masks()) & exceptions_flags;
MXCSR.set_exceptions(exceptions_flags);

View File

@ -203,6 +203,7 @@ float32 roundAndPackFloat32(int zSign, Bit16s zExp, Bit32u zSig, float_status_t
&& ((Bit32s) (zSig + roundIncrement) < 0)))
{
float_raise(status, float_flag_overflow | float_flag_inexact);
if (roundIncrement != 0) set_float_rounding_up(status);
return packFloat32(zSign, 0xFF, 0) - (roundIncrement == 0);
}
if (zExp < 0) {
@ -302,6 +303,7 @@ float64 roundAndPackFloat64(int zSign, Bit16s zExp, Bit64u zSig, float_status_t
&& ((Bit64s) (zSig + roundIncrement) < 0)))
{
float_raise(status, float_flag_overflow | float_flag_inexact);
if (roundIncrement != 0) set_float_rounding_up(status);
return packFloat64(zSign, 0x7FF, 0) - (roundIncrement == 0);
}
if (zExp < 0) {