Author: aandrejevic
Date: Sun Nov 10 00:53:05 2013
New Revision: 60910

URL: http://svn.reactos.org/svn/reactos?rev=60910&view=rev
Log:
[NTVDM]
Don't enable interrupts unless it's necessary in the interrupt handler.
[FAST486]
When handling interrupt signals, make sure at least one instruction is executed,
to prevent the CPU from being completely blocked by interrupt signals.


Modified:
    branches/ntvdm/lib/fast486/fast486.c
    branches/ntvdm/subsystems/ntvdm/int32.c

Modified: branches/ntvdm/lib/fast486/fast486.c
URL: 
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/fast486.c?rev=60910&r1=60909&r2=60910&view=diff
==============================================================================
--- branches/ntvdm/lib/fast486/fast486.c        [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/fast486.c        [iso-8859-1] Sun Nov 10 
00:53:05 2013
@@ -63,18 +63,9 @@
              * Check if there is an interrupt to execute, or a hardware 
interrupt signal
              * while interrupts are enabled.
              */
-            if ((State->IntStatus == FAST486_INT_EXECUTE)
-                || (State->Flags.If
-                && (State->IntAckCallback != NULL)
-                && (State->IntStatus == FAST486_INT_SIGNAL)))
+            if (State->IntStatus == FAST486_INT_EXECUTE)
             {
                 FAST486_IDT_ENTRY IdtEntry;
-
-                if (State->IntStatus == FAST486_INT_SIGNAL)
-                {
-                    /* Acknowledge the interrupt to get the number */
-                    State->PendingIntNum = State->IntAckCallback(State);
-                }
 
                 /* Get the interrupt vector */
                 if (Fast486GetIntVector(State, State->PendingIntNum, 
&IdtEntry))
@@ -88,6 +79,16 @@
 
                 /* Clear the interrupt status */
                 State->IntStatus = FAST486_INT_NONE;
+            }
+            else if (State->Flags.If
+                     && (State->IntAckCallback != NULL)
+                     && (State->IntStatus == FAST486_INT_SIGNAL))
+            {
+                /* Acknowledge the interrupt to get the number */
+                State->PendingIntNum = State->IntAckCallback(State);
+
+                /* Set the interrupt status to execute on the next instruction 
*/
+                State->IntStatus = FAST486_INT_EXECUTE;
             }
         }
 

Modified: branches/ntvdm/subsystems/ntvdm/int32.c
URL: 
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/int32.c?rev=60910&r1=60909&r2=60910&view=diff
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/int32.c     [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/int32.c     [iso-8859-1] Sun Nov 10 
00:53:05 2013
@@ -139,7 +139,7 @@
     {
         IntVecTable[i] = MAKELONG(Offset, BiosSegment);
 
-        BiosCode[Offset++] = 0xFB; // sti
+        BiosCode[Offset++] = 0xFA; // cli
 
         BiosCode[Offset++] = 0x6A; // push i
         BiosCode[Offset++] = (UCHAR)i;
@@ -158,11 +158,13 @@
         BiosCode[Offset++] = 0x73; // jnc EXIT (offset +3)
         BiosCode[Offset++] = 0x03;
 
+        BiosCode[Offset++] = 0xFB; // sti
+
         // HACK: The following instruction should be HLT!
         BiosCode[Offset++] = 0x90; // nop
 
         BiosCode[Offset++] = 0xEB; // jmp BOP_SEQ (offset -10)
-        BiosCode[Offset++] = 0xF6;
+        BiosCode[Offset++] = 0xF5;
 
 // EXIT:
         BiosCode[Offset++] = 0x83; // add sp, 4


Reply via email to