Author: aandrejevic
Date: Tue May 13 23:22:49 2014
New Revision: 63286
URL:
http://svn.reactos.org/svn/reactos?rev=63286&view=rev
Log:
[FAST486]
Fix a BOP-related stack corruption.
CORE-8199 #resolve #comment Fixed in revision r63286.
Modified:
trunk/reactos/include/reactos/libs/fast486/fast486.h
trunk/reactos/lib/fast486/fast486.c
trunk/reactos/lib/fast486/opcodes.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] Tue May 13 23:22:49
2014
@@ -159,7 +159,8 @@
{
FAST486_INT_NONE = 0,
FAST486_INT_EXECUTE = 1,
- FAST486_INT_SIGNAL = 2
+ FAST486_INT_SIGNAL = 2,
+ FAST486_INT_DELAYED = 3
} FAST486_INT_STATUS, *PFAST486_INT_STATUS;
typedef
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] Tue May 13 23:22:49 2014
@@ -119,6 +119,11 @@
State->PendingIntNum = State->IntAckCallback(State);
/* Set the interrupt status to execute on the next instruction */
+ State->IntStatus = FAST486_INT_EXECUTE;
+ }
+ else if (State->IntStatus == FAST486_INT_DELAYED)
+ {
+ /* Restore the old state */
State->IntStatus = FAST486_INT_EXECUTE;
}
}
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] Tue May 13 23:22:49 2014
@@ -4397,6 +4397,17 @@
/* Call the BOP handler */
State->BopCallback(State, BopCode);
+ /*
+ * If an interrupt should occur at this time, delay it.
+ * We must do this because if an interrupt begins and the BOP callback
+ * changes the CS:IP, the interrupt handler won't execute and the
+ * stack pointer will never be restored.
+ */
+ if (State->IntStatus == FAST486_INT_EXECUTE)
+ {
+ State->IntStatus = FAST486_INT_DELAYED;
+ }
+
/* Return success */
return TRUE;
}