From 12c22c774889c252293914df5c858003353a40a0 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Tue, 28 Apr 2015 00:56:56 +0000 Subject: [PATCH] [FAST486] The segment loading/storing MOV is always 16-bit and ignores OPSIZE. svn path=/trunk/; revision=67463 --- reactos/lib/fast486/opcodes.c | 64 ++++++++--------------------------- 1 file changed, 14 insertions(+), 50 deletions(-) diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index 6b3daef7cea..859009c3a9b 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -3832,16 +3832,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovModrm) FAST486_OPCODE_HANDLER(Fast486OpcodeMovStoreSeg) { - BOOLEAN OperandSize, AddressSize; + BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; FAST486_MOD_REG_RM ModRegRm; - OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; - /* Make sure this is the right instruction */ ASSERT(Opcode == 0x8C); TOGGLE_ADSIZE(AddressSize); - TOGGLE_OPSIZE(OperandSize); /* Get the operands */ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) @@ -3857,20 +3854,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovStoreSeg) return; } - if (OperandSize) - { - Fast486WriteModrmDwordOperands(State, - &ModRegRm, - FALSE, - State->SegmentRegs[ModRegRm.Register].Selector); - } - else - { - Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - State->SegmentRegs[ModRegRm.Register].Selector); - } + Fast486WriteModrmWordOperands(State, + &ModRegRm, + FALSE, + State->SegmentRegs[ModRegRm.Register].Selector); } FAST486_OPCODE_HANDLER(Fast486OpcodeLea) @@ -3921,16 +3908,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLea) FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) { - BOOLEAN OperandSize, AddressSize; + BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; FAST486_MOD_REG_RM ModRegRm; - - OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; + USHORT Selector; /* Make sure this is the right instruction */ ASSERT(Opcode == 0x8E); TOGGLE_ADSIZE(AddressSize); - TOGGLE_OPSIZE(OperandSize); /* Get the operands */ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) @@ -3947,37 +3932,16 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) return; } - if (OperandSize) + if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Selector)) { - ULONG Selector; - - if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Selector)) - { - /* Exception occurred */ - return; - } - - if (!Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector))) - { - /* Exception occurred */ - return; - } + /* Exception occurred */ + return; } - else - { - USHORT Selector; - if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Selector)) - { - /* Exception occurred */ - return; - } - - if (!Fast486LoadSegment(State, ModRegRm.Register, Selector)) - { - /* Exception occurred */ - return; - } + if (!Fast486LoadSegment(State, ModRegRm.Register, Selector)) + { + /* Exception occurred */ + return; } if ((INT)ModRegRm.Register == FAST486_REG_SS) -- 2.17.1