Author: aandrejevic Date: Fri Jun 5 14:02:24 2015 New Revision: 68021
URL: http://svn.reactos.org/svn/reactos?rev=68021&view=rev Log: [FAST486] - Restore the stack pointer on an exception. - Fix the parameter size for 286 call gates. Caught by V.
Modified: trunk/reactos/include/reactos/libs/fast486/fast486.h trunk/reactos/lib/fast486/common.c trunk/reactos/lib/fast486/fast486.c
Modified: trunk/reactos/include/reactos/libs/fast486/fast486.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/fast48... ============================================================================== --- trunk/reactos/include/reactos/libs/fast486/fast486.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/libs/fast486/fast486.h [iso-8859-1] Fri Jun 5 14:02:24 2015 @@ -515,6 +515,7 @@ FAST486_REG GeneralRegs[FAST486_NUM_GEN_REGS]; FAST486_SEG_REG SegmentRegs[FAST486_NUM_SEG_REGS]; FAST486_REG InstPtr, SavedInstPtr; + FAST486_REG SavedStackPtr; FAST486_FLAGS_REG Flags; FAST486_TABLE_REG Gdtr, Idtr; FAST486_LDT_REG Ldtr;
Modified: trunk/reactos/lib/fast486/common.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.c?rev=68... ============================================================================== --- trunk/reactos/lib/fast486/common.c [iso-8859-1] (original) +++ trunk/reactos/lib/fast486/common.c [iso-8859-1] Fri Jun 5 14:02:24 2015 @@ -579,6 +579,9 @@ /* Restore the IP to the saved IP */ State->InstPtr = State->SavedInstPtr;
+ /* Restore the SP to the saved SP */ + State->GeneralRegs[FAST486_REG_ESP] = State->SavedStackPtr; + /* Get the interrupt vector */ if (!Fast486GetIntVector(State, ExceptionCode, &IdtEntry)) { @@ -1040,7 +1043,7 @@ OldEsp, FALSE, ParamBuffer, - Gate->ParamCount * sizeof(ULONG))) + Gate->ParamCount * (GateSize ? sizeof(ULONG) : sizeof(USHORT)))) { /* Exception occurred */ return FALSE;
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] Fri Jun 5 14:02:24 2015 @@ -61,7 +61,11 @@ { NextInst: /* Check if this is a new instruction */ - if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr; + if (State->PrefixFlags == 0) + { + State->SavedInstPtr = State->InstPtr; + State->SavedStackPtr = State->GeneralRegs[FAST486_REG_ESP]; + }
/* Perform an instruction fetch */ if (!Fast486FetchByte(State, &Opcode))