X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=lib%2Ffast486%2Fextraops.c;h=ba2b5bd263fd9e8cf46efdc589c8c9fb95ef83a9;hp=64ae8ba731002b1b5a15b9b9c609da9c2cc75e01;hb=f3df799dc287792157b08d706c8e677924144e93;hpb=ff2d706fb51227e97b4b20bd3a6139f205213359 diff --git a/lib/fast486/extraops.c b/lib/fast486/extraops.c index 64ae8ba7310..ba2b5bd263f 100644 --- a/lib/fast486/extraops.c +++ b/lib/fast486/extraops.c @@ -215,7 +215,7 @@ Fast486ExtendedHandlers[FAST486_NUM_OPCODE_HANDLERS] = Fast486ExtOpcodeImul, Fast486ExtOpcodeCmpXchgByte, Fast486ExtOpcodeCmpXchg, - NULL, // TODO: OPCODE 0xB2 NOT IMPLEMENTED + Fast486ExtOpcodeLss, Fast486ExtOpcodeBtr, Fast486ExtOpcodeLfsLgs, Fast486ExtOpcodeLfsLgs, @@ -1102,6 +1102,74 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) return TRUE; } +FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLss) +{ + UCHAR FarPointer[6]; + BOOLEAN OperandSize, AddressSize; + FAST486_MOD_REG_RM ModRegRm; + + /* Make sure this is the right instruction */ + ASSERT(Opcode == 0xB2); + + OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; + + TOGGLE_OPSIZE(OperandSize); + TOGGLE_ADSIZE(AddressSize); + + /* Get the operands */ + if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) + { + /* Exception occurred */ + return FALSE; + } + + if (!ModRegRm.Memory) + { + /* Invalid */ + Fast486Exception(State, FAST486_EXCEPTION_UD); + return FALSE; + } + + if (!Fast486ReadMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) + ? State->SegmentOverride : FAST486_REG_DS, + ModRegRm.MemoryAddress, + FALSE, + FarPointer, + OperandSize ? 6 : 4)) + { + /* Exception occurred */ + return FALSE; + } + + if (OperandSize) + { + ULONG Offset = *((PULONG)FarPointer); + USHORT Segment = *((PUSHORT)&FarPointer[sizeof(ULONG)]); + + /* Set the register to the offset */ + State->GeneralRegs[ModRegRm.Register].Long = Offset; + + /* Load the segment */ + return Fast486LoadSegment(State, + FAST486_REG_SS, + Segment); + } + else + { + USHORT Offset = *((PUSHORT)FarPointer); + USHORT Segment = *((PUSHORT)&FarPointer[sizeof(USHORT)]); + + /* Set the register to the offset */ + State->GeneralRegs[ModRegRm.Register].LowWord = Offset; + + /* Load the segment */ + return Fast486LoadSegment(State, + FAST486_REG_SS, + Segment); + } +} + FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr) { BOOLEAN OperandSize, AddressSize; @@ -1204,6 +1272,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLfsLgs) OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; + TOGGLE_OPSIZE(OperandSize); TOGGLE_ADSIZE(AddressSize); /* Get the operands */