Author: aandrejevic
Date: Sun Oct 19 14:46:02 2014
New Revision: 64823
URL:
http://svn.reactos.org/svn/reactos?rev=64823&view=rev
Log:
[FAST486]
Implement the HLT instruction.
Remove the IdleCallback, since it's unused and probably won't be used.
(The load reduction will be implemented in NTVDM instead.)
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
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] Sun Oct 19 14:46:02
2014
@@ -205,13 +205,6 @@
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize
-);
-
-typedef
-VOID
-(NTAPI *FAST486_IDLE_PROC)
-(
- PFAST486_STATE State
);
typedef
@@ -474,7 +467,6 @@
FAST486_MEM_WRITE_PROC MemWriteCallback;
FAST486_IO_READ_PROC IoReadCallback;
FAST486_IO_WRITE_PROC IoWriteCallback;
- FAST486_IDLE_PROC IdleCallback;
FAST486_BOP_PROC BopCallback;
FAST486_INT_ACK_PROC IntAckCallback;
FAST486_REG GeneralRegs[FAST486_NUM_GEN_REGS];
@@ -490,6 +482,7 @@
ULONG ExceptionCount;
ULONG PrefixFlags;
FAST486_SEG_REGS SegmentOverride;
+ BOOLEAN Halted;
FAST486_INT_STATUS IntStatus;
UCHAR PendingIntNum;
PULONG Tlb;
@@ -510,7 +503,6 @@
FAST486_MEM_WRITE_PROC MemWriteCallback,
FAST486_IO_READ_PROC IoReadCallback,
FAST486_IO_WRITE_PROC IoWriteCallback,
- FAST486_IDLE_PROC IdleCallback,
FAST486_BOP_PROC BopCallback,
FAST486_INT_ACK_PROC IntAckCallback,
PULONG Tlb);
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] Sun Oct 19 14:46:02 2014
@@ -55,28 +55,31 @@
do
{
NextInst:
- /* Check if this is a new instruction */
- if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr;
-
- /* Perform an instruction fetch */
- if (!Fast486FetchByte(State, &Opcode))
- {
- /* Exception occurred */
+ if (!State->Halted)
+ {
+ /* Check if this is a new instruction */
+ if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr;
+
+ /* Perform an instruction fetch */
+ if (!Fast486FetchByte(State, &Opcode))
+ {
+ /* Exception occurred */
+ State->PrefixFlags = 0;
+ continue;
+ }
+
+ // TODO: Check for CALL/RET to update ProcedureCallCount.
+
+ /* Call the opcode handler */
+ CurrentHandler = Fast486OpcodeHandlers[Opcode];
+ CurrentHandler(State, Opcode);
+
+ /* If this is a prefix, go to the next instruction immediately */
+ if (CurrentHandler == Fast486OpcodePrefix) goto NextInst;
+
+ /* A non-prefix opcode has been executed, reset the prefix flags */
State->PrefixFlags = 0;
- continue;
- }
-
- // TODO: Check for CALL/RET to update ProcedureCallCount.
-
- /* Call the opcode handler */
- CurrentHandler = Fast486OpcodeHandlers[Opcode];
- CurrentHandler(State, Opcode);
-
- /* If this is a prefix, go to the next instruction immediately */
- if (CurrentHandler == Fast486OpcodePrefix) goto NextInst;
-
- /* A non-prefix opcode has been executed, reset the prefix flags */
- State->PrefixFlags = 0;
+ }
/*
* Check if there is an interrupt to execute, or a hardware interrupt signal
@@ -84,6 +87,9 @@
*/
if (State->Flags.Tf)
{
+ /* No longer halted */
+ State->Halted = FALSE;
+
/* Perform the interrupt */
Fast486PerformInterrupt(State, 0x01);
@@ -165,13 +171,6 @@
static VOID
NTAPI
-Fast486IdleCallback(PFAST486_STATE State)
-{
- UNREFERENCED_PARAMETER(State);
-}
-
-static VOID
-NTAPI
Fast486BopCallback(PFAST486_STATE State, UCHAR BopCode)
{
UNREFERENCED_PARAMETER(State);
@@ -197,7 +196,6 @@
FAST486_MEM_WRITE_PROC MemWriteCallback,
FAST486_IO_READ_PROC IoReadCallback,
FAST486_IO_WRITE_PROC IoWriteCallback,
- FAST486_IDLE_PROC IdleCallback,
FAST486_BOP_PROC BopCallback,
FAST486_INT_ACK_PROC IntAckCallback,
PULONG Tlb)
@@ -207,7 +205,6 @@
State->MemWriteCallback = (MemWriteCallback ? MemWriteCallback :
Fast486MemWriteCallback);
State->IoReadCallback = (IoReadCallback ? IoReadCallback :
Fast486IoReadCallback );
State->IoWriteCallback = (IoWriteCallback ? IoWriteCallback :
Fast486IoWriteCallback );
- State->IdleCallback = (IdleCallback ? IdleCallback :
Fast486IdleCallback );
State->BopCallback = (BopCallback ? BopCallback :
Fast486BopCallback );
State->IntAckCallback = (IntAckCallback ? IntAckCallback :
Fast486IntAckCallback );
@@ -229,7 +226,6 @@
FAST486_MEM_WRITE_PROC MemWriteCallback = State->MemWriteCallback;
FAST486_IO_READ_PROC IoReadCallback = State->IoReadCallback;
FAST486_IO_WRITE_PROC IoWriteCallback = State->IoWriteCallback;
- FAST486_IDLE_PROC IdleCallback = State->IdleCallback;
FAST486_BOP_PROC BopCallback = State->BopCallback;
FAST486_INT_ACK_PROC IntAckCallback = State->IntAckCallback;
PULONG Tlb = State->Tlb;
@@ -283,7 +279,6 @@
State->MemWriteCallback = MemWriteCallback;
State->IoReadCallback = IoReadCallback;
State->IoWriteCallback = IoWriteCallback;
- State->IdleCallback = IdleCallback;
State->BopCallback = BopCallback;
State->IntAckCallback = IntAckCallback;
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] Sun Oct 19 14:46:02 2014
@@ -574,12 +574,6 @@
FAST486_OPCODE_HANDLER(Fast486OpcodeNop)
{
- if (State->PrefixFlags & FAST486_PREFIX_REP)
- {
- /* Idle cycle */
- State->IdleCallback(State);
- }
-
return TRUE;
}
@@ -895,7 +889,7 @@
}
/* Halt */
- // TODO: Halt the CPU until an interrupt occurs, using IdleCallback if needed.
+ State->Halted = TRUE;
/* Return success */
return TRUE;
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] Sun Oct 19 14:46:02 2014
@@ -163,7 +163,6 @@
EmulatorWriteMemory,
EmulatorReadIo,
EmulatorWriteIo,
- NULL,
EmulatorBiosOperation,
EmulatorIntAcknowledge,
NULL /* TODO: Use a TLB */);