Author: aandrejevic
Date: Sat Jan 3 15:16:41 2015
New Revision: 65961
URL:
http://svn.reactos.org/svn/reactos?rev=65961&view=rev
Log:
[FAST486][NTVDM]
Use an external interrupt for the FPU when the NE bit of CR0 is cleared.
Modified:
trunk/reactos/include/reactos/libs/fast486/fast486.h
trunk/reactos/lib/fast486/fast486.c
trunk/reactos/lib/fast486/opcodes.c
trunk/reactos/subsystems/ntvdm/cpu/cpu.c
trunk/reactos/subsystems/ntvdm/emulator.c
trunk/reactos/subsystems/ntvdm/emulator.h
Modified: trunk/reactos/include/reactos/libs/fast486/fast486.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/fast4…
==============================================================================
--- trunk/reactos/include/reactos/libs/fast486/fast486.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/libs/fast486/fast486.h [iso-8859-1] Sat Jan 3 15:16:41
2015
@@ -223,6 +223,13 @@
typedef
UCHAR
(NTAPI *FAST486_INT_ACK_PROC)
+(
+ PFAST486_STATE State
+);
+
+typedef
+VOID
+(NTAPI *FAST486_FPU_PROC)
(
PFAST486_STATE State
);
@@ -473,6 +480,7 @@
FAST486_IO_WRITE_PROC IoWriteCallback;
FAST486_BOP_PROC BopCallback;
FAST486_INT_ACK_PROC IntAckCallback;
+ FAST486_FPU_PROC FpuCallback;
FAST486_REG GeneralRegs[FAST486_NUM_GEN_REGS];
FAST486_SEG_REG SegmentRegs[FAST486_NUM_SEG_REGS];
FAST486_REG InstPtr, SavedInstPtr;
@@ -514,6 +522,7 @@
FAST486_IO_WRITE_PROC IoWriteCallback,
FAST486_BOP_PROC BopCallback,
FAST486_INT_ACK_PROC IntAckCallback,
+ FAST486_FPU_PROC FpuCallback,
PULONG Tlb);
VOID
Modified: trunk/reactos/lib/fast486/fast486.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/fast486.c?rev=…
==============================================================================
--- trunk/reactos/lib/fast486/fast486.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/fast486.c [iso-8859-1] Sat Jan 3 15:16:41 2015
@@ -179,6 +179,12 @@
return 0x01;
}
+static VOID NTAPI
+Fast486FpuCallback(PFAST486_STATE State)
+{
+ UNREFERENCED_PARAMETER(State);
+}
+
/* PUBLIC FUNCTIONS ***********************************************************/
VOID
@@ -190,6 +196,7 @@
FAST486_IO_WRITE_PROC IoWriteCallback,
FAST486_BOP_PROC BopCallback,
FAST486_INT_ACK_PROC IntAckCallback,
+ FAST486_FPU_PROC FpuCallback,
PULONG Tlb)
{
/* Set the callbacks (or use default ones if some are NULL) */
@@ -199,6 +206,7 @@
State->IoWriteCallback = (IoWriteCallback ? IoWriteCallback :
Fast486IoWriteCallback );
State->BopCallback = (BopCallback ? BopCallback :
Fast486BopCallback );
State->IntAckCallback = (IntAckCallback ? IntAckCallback :
Fast486IntAckCallback );
+ State->FpuCallback = (FpuCallback ? FpuCallback :
Fast486FpuCallback );
/* Set the TLB (if given) */
State->Tlb = Tlb;
@@ -220,6 +228,7 @@
FAST486_IO_WRITE_PROC IoWriteCallback = State->IoWriteCallback;
FAST486_BOP_PROC BopCallback = State->BopCallback;
FAST486_INT_ACK_PROC IntAckCallback = State->IntAckCallback;
+ FAST486_FPU_PROC FpuCallback = State->FpuCallback;
PULONG Tlb = State->Tlb;
/* Clear the entire structure */
@@ -273,6 +282,7 @@
State->IoWriteCallback = IoWriteCallback;
State->BopCallback = BopCallback;
State->IntAckCallback = IntAckCallback;
+ State->FpuCallback = FpuCallback;
State->Tlb = Tlb;
}
Modified: trunk/reactos/lib/fast486/opcodes.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/opcodes.c?rev=…
==============================================================================
--- trunk/reactos/lib/fast486/opcodes.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/opcodes.c [iso-8859-1] Sat Jan 3 15:16:41 2015
@@ -4125,8 +4125,16 @@
|| (!State->FpuControl.Dm && State->FpuStatus.De)
|| (!State->FpuControl.Im && State->FpuStatus.Ie))
{
- /* Call the #MF handler */
- Fast486Exception(State, FAST486_EXCEPTION_MF);
+ if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_NE)
+ {
+ /* Call the #MF handler */
+ Fast486Exception(State, FAST486_EXCEPTION_MF);
+ }
+ else
+ {
+ /* Use the external interrupt */
+ State->FpuCallback(State);
+ }
}
#endif
Modified: trunk/reactos/subsystems/ntvdm/cpu/cpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/cpu/cpu.c…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/cpu/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/cpu/cpu.c [iso-8859-1] Sat Jan 3 15:16:41 2015
@@ -165,6 +165,7 @@
EmulatorWriteIo,
EmulatorBiosOperation,
EmulatorIntAcknowledge,
+ EmulatorFpu,
NULL /* TODO: Use a TLB */);
/* Initialize the software callback system and register the emulator BOPs */
Modified: trunk/reactos/subsystems/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/emulator.…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/emulator.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/emulator.c [iso-8859-1] Sat Jan 3 15:16:41 2015
@@ -210,6 +210,12 @@
/* Get the interrupt number from the PIC */
return PicGetInterrupt();
+}
+
+VOID WINAPI EmulatorFpu(PFAST486_STATE State)
+{
+ /* The FPU is wired to IRQ 13 */
+ PicInterruptRequest(13);
}
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack)
Modified: trunk/reactos/subsystems/ntvdm/emulator.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/emulator.…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/emulator.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/emulator.h [iso-8859-1] Sat Jan 3 15:16:41 2015
@@ -92,6 +92,11 @@
PFAST486_STATE State
);
+VOID WINAPI EmulatorFpu
+(
+ PFAST486_STATE State
+);
+
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack);
VOID EmulatorTerminate(VOID);