Send #MF exception for MMX instructions if there is a pending FPU exception

This commit is contained in:
Stanislav Shwartsman 2003-04-05 12:49:14 +00:00
parent 1e71c9e56e
commit 216124c6c3
2 changed files with 11 additions and 16 deletions

View File

@ -152,12 +152,12 @@ typedef struct
#ifdef BX_BIG_ENDIAN
Bit16u aligment1, aligment2, aligment3;
Bit16u exp; /* 4 bytes: FP register exponent,
set to 0xffff by all MMX commands */
set to 0xffff by all MMX instructions */
BxPackedMmxRegister packed_mmx_register;
#else
BxPackedMmxRegister packed_mmx_register;
Bit16u exp; /* 4 bytes: FP register exponent,
set to 0xffff by all MMX commands */
set to 0xffff by all MMX instructions */
Bit16u aligment1, aligment2, aligment3;
#endif
} BxMmxRegister;

View File

@ -94,7 +94,7 @@ void BX_CPU_C::printMmxRegisters(void)
{
for(int i=0;i<8;i++) {
BxPackedMmxRegister mm = BX_READ_MMX_REG(i);
fprintf(stderr, "MM%d: %.16llx\n", i, MMXUQ(mm));
fprintf(stderr, "MM%d: %lx%lx\n", i, MMXUD1(mm), MMXUD0(mm));
}
}
@ -106,9 +106,13 @@ void BX_CPU_C::prepareMMX(void)
if(BX_CPU_THIS_PTR cr0.em)
exception(BX_UD_EXCEPTION, 0, 0);
/* check SW_Summary bit for a pending FPU exceptions */
if(FPU_SWD & 0x0080)
exception(BX_MF_EXCEPTION, 0, 0);
FPU_TWD = 0;
FPU_TOS = 0; /* Each time an MMX instruction is */
FPU_SWD &= 0xc7ff; /* executed, the TOS value is set to 000b */
FPU_TOS = 0; /* reset FPU Top-Of-Stack */
FPU_SWD &= 0xc7ff;
}
#endif
@ -682,17 +686,8 @@ void BX_CPU_C::PCMPEQD_PqQq(bxInstruction_c *i)
void BX_CPU_C::EMMS(bxInstruction_c *i)
{
#if BX_SUPPORT_MMX
if(BX_CPU_THIS_PTR cr0.em)
exception(BX_UD_EXCEPTION, 0, 0);
if(BX_CPU_THIS_PTR cr0.ts)
exception(BX_NM_EXCEPTION, 0, 0);
FPU_TWD = 0xffffffff;
FPU_TOS = 0; /* Each time an MMX instruction is */
FPU_SWD &= 0xc7ff; /* executed, the TOS value is set to 000b */
BX_CPU_THIS_PTR prepareMMX();
FPU_TWD = 0xffffffff; // toDO: FPU_TWD should be 16bit
#else
BX_INFO(("EMMS: required MMX, use --enable-mmx option"));
UndefinedOpcode(i);