Author: aandrejevic
Date: Sat Nov 30 02:03:51 2013
New Revision: 61150
URL:
http://svn.reactos.org/svn/reactos?rev=61150&view=rev
Log:
[FAST486]
FPU instructions never generate #UD. If CR0.EM is set, they generate #NM.
If there is no FPU and CR0.EM is cleared, they do nothing.
Add a helper macro FPU_ST for accessing FPU registers.
Add a compile-time option to disable the FPU.
Modified:
branches/ntvdm/lib/fast486/fast486.c
branches/ntvdm/lib/fast486/fpu.c
branches/ntvdm/lib/fast486/fpu.h
Modified: branches/ntvdm/lib/fast486/fast486.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/fast486.c?rev…
==============================================================================
--- branches/ntvdm/lib/fast486/fast486.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/fast486.c [iso-8859-1] Sat Nov 30 02:03:51 2013
@@ -266,8 +266,10 @@
State->Idtr.Size = 0x3FF;
State->Idtr.Address = 0;
+#ifndef FAST486_NO_FPU
/* Initialize CR0 */
State->ControlRegisters[FAST486_REG_CR0] |= FAST486_CR0_ET;
+#endif
/* Restore the callbacks and TLB */
State->MemReadCallback = MemReadCallback;
Modified: branches/ntvdm/lib/fast486/fpu.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/fpu.c?rev=611…
==============================================================================
--- branches/ntvdm/lib/fast486/fpu.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/fpu.c [iso-8859-1] Sat Nov 30 02:03:51 2013
@@ -35,66 +35,122 @@
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDA)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDC)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDD)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDE)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDF)
{
+ FPU_CHECK();
+
+#ifndef FAST486_NO_FPU
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
- Fast486Exception(State, FAST486_EXCEPTION_UD);
+
return FALSE;
+#else
+ /* Do nothing */
+ return TRUE;
+#endif
}
/* EOF */
Modified: branches/ntvdm/lib/fast486/fpu.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/fpu.h?rev=611…
==============================================================================
--- branches/ntvdm/lib/fast486/fpu.h [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/fpu.h [iso-8859-1] Sat Nov 30 02:03:51 2013
@@ -26,6 +26,13 @@
/* DEFINES ********************************************************************/
+#define FPU_CHECK() if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_EM)
\
+ { \
+ Fast486Exception(State, FAST486_EXCEPTION_NM); \
+ return FALSE; \
+ }
+#define FPU_ST(i) State->FpuRegisters[(State->FpuStatus.Top + (i)) %
FAST486_NUM_FPU_REGS]
+
enum
{
FPU_SINGLE_PRECISION = 0,