From f9dd2776ab0800c74debec6ef319617218955cf2 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Tue, 17 Sep 2013 23:12:25 +0000 Subject: [PATCH] [SOFT386] Fix the ARPL instruction. Use "inline" instead of FORCEINLINE for static functions. svn path=/branches/ntvdm/; revision=60195 --- lib/soft386/common.c | 3 ++- lib/soft386/opcodes.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/soft386/common.c b/lib/soft386/common.c index 46dfc672a44..b8e95144a96 100644 --- a/lib/soft386/common.c +++ b/lib/soft386/common.c @@ -20,7 +20,8 @@ /* PRIVATE FUNCTIONS **********************************************************/ -static /* FORCEINLINE */ +static +inline ULONG Soft386GetPageTableEntry(PSOFT386_STATE State, ULONG VirtualAddress) diff --git a/lib/soft386/opcodes.c b/lib/soft386/opcodes.c index 2120bb40b67..0914a234956 100644 --- a/lib/soft386/opcodes.c +++ b/lib/soft386/opcodes.c @@ -3686,16 +3686,31 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeArpl) { USHORT FirstValue, SecondValue; SOFT386_MOD_REG_RM ModRegRm; + BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size; if (!(State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE) - || State->PrefixFlags) + || State->Flags.Vm + || (State->PrefixFlags & SOFT386_PREFIX_LOCK)) { - /* No prefixes allowed, protected mode only */ + /* Cannot be used in real mode or with a LOCK prefix */ Soft386Exception(State, SOFT386_EXCEPTION_UD); return FALSE; } + if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE) + { + /* The ADSIZE prefix toggles the size */ + AddressSize = !AddressSize; + } + /* Get the operands */ + if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm)) + { + /* Exception occurred */ + return FALSE; + } + + /* Read the operands */ if (!Soft386ReadModrmWordOperands(State, &ModRegRm, &FirstValue,