From 87a7896249ca98cfbdce00111e7dd96bc9eaf7c4 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sun, 29 Sep 2013 15:52:20 +0000 Subject: [PATCH] [SOFT386] Implement opcode group 0x8F. svn path=/branches/ntvdm/; revision=60451 --- lib/soft386/opgroups.c | 54 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/soft386/opgroups.c b/lib/soft386/opgroups.c index ecebc944dd1..c228b2920f0 100644 --- a/lib/soft386/opgroups.c +++ b/lib/soft386/opgroups.c @@ -175,8 +175,58 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeGroup83) SOFT386_OPCODE_HANDLER(Soft386OpcodeGroup8F) { - UNIMPLEMENTED; - return FALSE; // TODO: NOT IMPLEMENTED + ULONG Value; + SOFT386_MOD_REG_RM ModRegRm; + BOOLEAN OperandSize, AddressSize; + + OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size; + + if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE) + { + /* The OPSIZE prefix toggles the size */ + OperandSize = !OperandSize; + } + + if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE) + { + /* The ADSIZE prefix toggles the size */ + AddressSize = !AddressSize; + } + + if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm)) + { + /* Exception occurred */ + return FALSE; + } + + if (ModRegRm.Register != 0) + { + /* Invalid */ + Soft386Exception(State, SOFT386_EXCEPTION_UD); + return FALSE; + } + + /* Pop a value from the stack */ + if (!Soft386StackPop(State, &Value)) + { + /* Exception occurred */ + return FALSE; + } + + if (OperandSize) + { + return Soft386WriteModrmDwordOperands(State, + &ModRegRm, + FALSE, + Value); + } + else + { + return Soft386WriteModrmWordOperands(State, + &ModRegRm, + FALSE, + LOWORD(Value)); + } } SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupC0)