Author: hbelusca Date: Sat Oct 18 14:08:50 2014 New Revision: 64803
URL: http://svn.reactos.org/svn/reactos?rev=64803&view=rev Log: [FAST486]: Implement a basic support for the Trap Flag.
Modified: trunk/reactos/lib/fast486/debug.c trunk/reactos/lib/fast486/fast486.c
Modified: trunk/reactos/lib/fast486/debug.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/debug.c?rev=648... ============================================================================== --- trunk/reactos/lib/fast486/debug.c [iso-8859-1] (original) +++ trunk/reactos/lib/fast486/debug.c [iso-8859-1] Sat Oct 18 14:08:50 2014 @@ -83,7 +83,21 @@ * Check if there is an interrupt to execute, or a hardware interrupt signal * while interrupts are enabled. */ - if (State->IntStatus == FAST486_INT_EXECUTE) + if (State->Flags.Tf) + { + /* 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; + } + else if (State->IntStatus == FAST486_INT_EXECUTE) { /* Perform the interrupt */ Fast486PerformInterrupt(State, State->PendingIntNum); @@ -91,8 +105,7 @@ /* Clear the interrupt status */ State->IntStatus = FAST486_INT_NONE; } - else if (State->Flags.If && (State->IntStatus == FAST486_INT_SIGNAL) - && (State->IntAckCallback != NULL)) + else if (State->Flags.If && (State->IntStatus == FAST486_INT_SIGNAL)) { /* Acknowledge the interrupt to get the number */ State->PendingIntNum = State->IntAckCallback(State);
Modified: trunk/reactos/lib/fast486/fast486.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/fast486.c?rev=6... ============================================================================== --- trunk/reactos/lib/fast486/fast486.c [iso-8859-1] (original) +++ trunk/reactos/lib/fast486/fast486.c [iso-8859-1] Sat Oct 18 14:08:50 2014 @@ -82,7 +82,21 @@ * Check if there is an interrupt to execute, or a hardware interrupt signal * while interrupts are enabled. */ - if (State->IntStatus == FAST486_INT_EXECUTE) + if (State->Flags.Tf) + { + /* 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; + } + else if (State->IntStatus == FAST486_INT_EXECUTE) { /* Perform the interrupt */ Fast486PerformInterrupt(State, State->PendingIntNum); @@ -90,8 +104,7 @@ /* Clear the interrupt status */ State->IntStatus = FAST486_INT_NONE; } - else if (State->Flags.If && (State->IntStatus == FAST486_INT_SIGNAL) - && (State->IntAckCallback != NULL)) + else if (State->Flags.If && (State->IntStatus == FAST486_INT_SIGNAL)) { /* Acknowledge the interrupt to get the number */ State->PendingIntNum = State->IntAckCallback(State); @@ -171,8 +184,8 @@ { UNREFERENCED_PARAMETER(State);
- /* Return something... */ - return 0; + /* Return something... defaulted to single-step interrupt */ + return 0x01; }
/* PUBLIC FUNCTIONS ***********************************************************/ @@ -211,6 +224,7 @@ { FAST486_SEG_REGS i;
+ /* Save the callbacks and TLB */ FAST486_MEM_READ_PROC MemReadCallback = State->MemReadCallback; FAST486_MEM_WRITE_PROC MemWriteCallback = State->MemWriteCallback; FAST486_IO_READ_PROC IoReadCallback = State->IoReadCallback;