[FAST486]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Thu, 4 Jun 2015 14:48:07 +0000 (14:48 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Thu, 4 Jun 2015 14:48:07 +0000 (14:48 +0000)
- Interrupts always clear TF.
- Let at least one instruction happen between #DB's (when TF is set).

svn path=/trunk/; revision=68014

reactos/lib/fast486/common.c
reactos/lib/fast486/fast486.c

index 1a2bb09..9a580af 100644 (file)
@@ -430,8 +430,8 @@ Fast486InterruptInternal(PFAST486_STATE State,
             State->InstPtr.LowWord = IdtEntry->Offset;
         }
 
-        /* Clear TF and NT */
-        State->Flags.Tf = State->Flags.Nt = FALSE;
+        /* Clear NT */
+       State->Flags.Nt = FALSE;
 
         if (OldVm)
         {
@@ -513,6 +513,9 @@ Fast486InterruptInternal(PFAST486_STATE State,
         State->Flags.If = FALSE;
     }
 
+    /* Clear TF */
+    State->Flags.Tf = FALSE;
+
     return TRUE;
 }
 
index 0ad6988..4db9b86 100644 (file)
@@ -50,10 +50,13 @@ Fast486ExecutionControl(PFAST486_STATE State, FAST486_EXEC_CMD Command)
     UCHAR Opcode;
     FAST486_OPCODE_HANDLER_PROC CurrentHandler;
     INT ProcedureCallCount = 0;
+    BOOLEAN Trap;
 
     /* Main execution loop */
     do
     {
+        Trap = State->Flags.Tf;
+
         if (!State->Halted)
         {
 NextInst:
@@ -90,19 +93,10 @@ NextInst:
             /* Clear the interrupt delay flag */
             State->DoNotInterrupt = FALSE;
         }
-        else if (State->Flags.Tf && !State->Halted)
+        else if (Trap && !State->Halted)
         {
             /* Perform the interrupt */
-            Fast486PerformInterrupt(State, 0x01);
-
-            /*
-             * Flags and TF are pushed on stack so we can reset TF now,
-             * to not break into the INT 0x01 handler.
-             * After the INT 0x01 handler returns, the flags and therefore
-             * TF are popped back off the stack and restored, so TF will be
-             * automatically reset to its previous state.
-             */
-            State->Flags.Tf = FALSE;
+            Fast486PerformInterrupt(State, FAST486_EXCEPTION_DB);
         }
         else if (State->Flags.If && State->IntSignaled)
         {