[FAST486]

- Restore the stack pointer on an exception.
- Fix the parameter size for 286 call gates. Caught by V.


svn path=/trunk/; revision=68021
This commit is contained in:
Aleksandar Andrejevic 2015-06-05 14:02:24 +00:00
parent c3f90daa0d
commit 8bdaa7f0e1
3 changed files with 10 additions and 2 deletions

View file

@ -515,6 +515,7 @@ struct _FAST486_STATE
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;

View file

@ -579,6 +579,9 @@ Fast486ExceptionWithErrorCode(PFAST486_STATE State,
/* 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 @@ Fast486CallGate(PFAST486_STATE State,
OldEsp,
FALSE,
ParamBuffer,
Gate->ParamCount * sizeof(ULONG)))
Gate->ParamCount * (GateSize ? sizeof(ULONG) : sizeof(USHORT))))
{
/* Exception occurred */
return FALSE;

View file

@ -61,7 +61,11 @@ Fast486ExecutionControl(PFAST486_STATE State, FAST486_EXEC_CMD Command)
{
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))