Author: aandrejevic Date: Fri Oct 11 12:24:05 2013 New Revision: 60603
URL: http://svn.reactos.org/svn/reactos?rev=60603&view=rev Log: [SOFT386] Fix a bug in Soft386ExceptionWithErrorCode. The instruction pointer exceptions can return to should point to the instruction that caused the exception.
Modified: branches/ntvdm/include/reactos/libs/soft386/soft386.h branches/ntvdm/lib/soft386/common.c branches/ntvdm/lib/soft386/soft386.c
Modified: branches/ntvdm/include/reactos/libs/soft386/soft386.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/include/reactos/libs/soft3... ============================================================================== --- branches/ntvdm/include/reactos/libs/soft386/soft386.h [iso-8859-1] (original) +++ branches/ntvdm/include/reactos/libs/soft386/soft386.h [iso-8859-1] Fri Oct 11 12:24:05 2013 @@ -319,7 +319,7 @@ SOFT386_BOP_PROC BopCallback; SOFT386_REG GeneralRegs[SOFT386_NUM_GEN_REGS]; SOFT386_SEG_REG SegmentRegs[SOFT386_NUM_SEG_REGS]; - SOFT386_REG InstPtr; + SOFT386_REG InstPtr, SavedInstPtr; SOFT386_FLAGS_REG Flags; SOFT386_TABLE_REG Gdtr, Idtr, Ldtr, Tss; ULONGLONG TimeStampCounter;
Modified: branches/ntvdm/lib/soft386/common.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/common.c?rev=6... ============================================================================== --- branches/ntvdm/lib/soft386/common.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/common.c [iso-8859-1] Fri Oct 11 12:24:05 2013 @@ -469,6 +469,9 @@ return; }
+ /* Restore the IP to the saved IP */ + State->InstPtr = State->SavedInstPtr; + if (!Soft386GetIntVector(State, ExceptionCode, &IdtEntry)) { /*
Modified: branches/ntvdm/lib/soft386/soft386.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/soft386.c?rev=... ============================================================================== --- branches/ntvdm/lib/soft386/soft386.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/soft386.c [iso-8859-1] Fri Oct 11 12:24:05 2013 @@ -56,6 +56,9 @@ /* Main execution loop */ do { + /* If this is a new instruction, save the IP */ + if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr; + /* Perform an instruction fetch */ if (!Soft386FetchByte(State, &Opcode)) continue;