From dc29fa9ab1249eb34a3109b16fa049e22c31c134 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Fri, 27 Sep 2013 21:23:34 +0000 Subject: [PATCH] [SOFT386] Fix the return to VM86 mode. The VM flag must be set before the call to Soft386LoadSegment. svn path=/branches/ntvdm/; revision=60393 --- lib/soft386/opcodes.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/soft386/opcodes.c b/lib/soft386/opcodes.c index 24ac6c864bb..d614df42620 100644 --- a/lib/soft386/opcodes.c +++ b/lib/soft386/opcodes.c @@ -4791,14 +4791,6 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeIret) if (!Soft386StackPop(State, &Fs)) return FALSE; if (!Soft386StackPop(State, &Gs)) return FALSE; - /* Load the new segments */ - if (!Soft386LoadSegment(State, SOFT386_REG_CS, CodeSel)) return FALSE; - if (!Soft386LoadSegment(State, SOFT386_REG_SS, StackSel)) return FALSE; - if (!Soft386LoadSegment(State, SOFT386_REG_ES, Es)) return FALSE; - if (!Soft386LoadSegment(State, SOFT386_REG_DS, Ds)) return FALSE; - if (!Soft386LoadSegment(State, SOFT386_REG_FS, Fs)) return FALSE; - if (!Soft386LoadSegment(State, SOFT386_REG_GS, Gs)) return FALSE; - /* Set the new IP */ State->InstPtr.Long = LOWORD(InstPtr); @@ -4807,6 +4799,14 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeIret) else State->Flags.LowWord = NewFlags.LowWord & REAL_MODE_FLAGS_MASK; State->Flags.AlwaysSet = State->Flags.Vm = TRUE; + /* Load the new segments */ + if (!Soft386LoadSegment(State, SOFT386_REG_CS, CodeSel)) return FALSE; + if (!Soft386LoadSegment(State, SOFT386_REG_SS, StackSel)) return FALSE; + if (!Soft386LoadSegment(State, SOFT386_REG_ES, Es)) return FALSE; + if (!Soft386LoadSegment(State, SOFT386_REG_DS, Ds)) return FALSE; + if (!Soft386LoadSegment(State, SOFT386_REG_FS, Fs)) return FALSE; + if (!Soft386LoadSegment(State, SOFT386_REG_GS, Gs)) return FALSE; + return TRUE; }