Author: aandrejevic Date: Sun Sep 29 16:01:10 2013 New Revision: 60452
URL: http://svn.reactos.org/svn/reactos?rev=60452&view=rev Log: [SOFT386] Implement opcode groups 0xC6 and 0xC7.
Modified: branches/ntvdm/lib/soft386/opgroups.c
Modified: branches/ntvdm/lib/soft386/opgroups.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opgroups.c?rev... ============================================================================== --- branches/ntvdm/lib/soft386/opgroups.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/opgroups.c [iso-8859-1] Sun Sep 29 16:01:10 2013 @@ -243,14 +243,106 @@
SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupC6) { - UNIMPLEMENTED; - return FALSE; // TODO: NOT IMPLEMENTED + UCHAR Immediate; + SOFT386_MOD_REG_RM ModRegRm; + BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size; + + 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; + } + + /* Get the immediate operand */ + if (!Soft386FetchByte(State, &Immediate)) + { + /* Exception occurred */ + return FALSE; + } + + return Soft386WriteModrmByteOperands(State, + &ModRegRm, + FALSE, + Immediate); }
SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupC7) { - UNIMPLEMENTED; - return FALSE; // TODO: NOT IMPLEMENTED + 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; + } + + if (OperandSize) + { + ULONG Immediate; + + /* Get the immediate operand */ + if (!Soft386FetchDword(State, &Immediate)) + { + /* Exception occurred */ + return FALSE; + } + + return Soft386WriteModrmDwordOperands(State, + &ModRegRm, + FALSE, + Immediate); + } + else + { + USHORT Immediate; + + /* Get the immediate operand */ + if (!Soft386FetchWord(State, &Immediate)) + { + /* Exception occurred */ + return FALSE; + } + + return Soft386WriteModrmWordOperands(State, + &ModRegRm, + FALSE, + Immediate); + } }
SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupD0)