mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[SOFT386]
Allow the DS segment to overriden in LODS, MOVS and CMPS. svn path=/branches/ntvdm/; revision=60689
This commit is contained in:
parent
40ed113494
commit
6bbc6fef9a
1 changed files with 21 additions and 8 deletions
|
@ -6080,6 +6080,7 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeMovs)
|
||||||
{
|
{
|
||||||
ULONG Data, DataSize;
|
ULONG Data, DataSize;
|
||||||
BOOLEAN OperandSize, AddressSize;
|
BOOLEAN OperandSize, AddressSize;
|
||||||
|
SOFT386_SEG_REGS Segment = SOFT386_REG_DS;
|
||||||
|
|
||||||
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
|
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
|
||||||
|
|
||||||
|
@ -6098,6 +6099,12 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeMovs)
|
||||||
AddressSize = !AddressSize;
|
AddressSize = !AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (State->PrefixFlags & SOFT386_PREFIX_SEG)
|
||||||
|
{
|
||||||
|
/* Use the override segment instead of DS */
|
||||||
|
Segment = State->SegmentOverride;
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the size */
|
/* Calculate the size */
|
||||||
if (Opcode == 0xA4) DataSize = sizeof(UCHAR);
|
if (Opcode == 0xA4) DataSize = sizeof(UCHAR);
|
||||||
else DataSize = OperandSize ? sizeof(ULONG) : sizeof(USHORT);
|
else DataSize = OperandSize ? sizeof(ULONG) : sizeof(USHORT);
|
||||||
|
@ -6148,7 +6155,7 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeMovs)
|
||||||
|
|
||||||
/* Read from memory */
|
/* Read from memory */
|
||||||
if (!Soft386ReadMemory(State,
|
if (!Soft386ReadMemory(State,
|
||||||
SOFT386_REG_DS,
|
Segment,
|
||||||
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
|
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
|
||||||
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
|
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -6267,6 +6274,7 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCmps)
|
||||||
ULONG FirstValue = 0, SecondValue = 0, Result;
|
ULONG FirstValue = 0, SecondValue = 0, Result;
|
||||||
ULONG DataSize, DataMask, SignFlag;
|
ULONG DataSize, DataMask, SignFlag;
|
||||||
BOOLEAN OperandSize, AddressSize;
|
BOOLEAN OperandSize, AddressSize;
|
||||||
|
SOFT386_SEG_REGS Segment = SOFT386_REG_DS;
|
||||||
|
|
||||||
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
|
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
|
||||||
|
|
||||||
|
@ -6285,12 +6293,10 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCmps)
|
||||||
AddressSize = !AddressSize;
|
AddressSize = !AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((State->PrefixFlags & SOFT386_PREFIX_REP)
|
if (State->PrefixFlags & SOFT386_PREFIX_SEG)
|
||||||
|| (State->PrefixFlags & SOFT386_PREFIX_REPNZ))
|
|
||||||
{
|
{
|
||||||
// TODO: The REP/REPZ/REPNZ prefixes need to be implemented!
|
/* Use the override segment instead of DS */
|
||||||
Soft386Exception(State, SOFT386_EXCEPTION_UD);
|
Segment = State->SegmentOverride;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the size */
|
/* Calculate the size */
|
||||||
|
@ -6303,7 +6309,7 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCmps)
|
||||||
|
|
||||||
/* Read from the first source operand */
|
/* Read from the first source operand */
|
||||||
if (!Soft386ReadMemory(State,
|
if (!Soft386ReadMemory(State,
|
||||||
SOFT386_REG_DS,
|
Segment,
|
||||||
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
|
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
|
||||||
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
|
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -6553,6 +6559,7 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeLods)
|
||||||
{
|
{
|
||||||
ULONG DataSize;
|
ULONG DataSize;
|
||||||
BOOLEAN OperandSize, AddressSize;
|
BOOLEAN OperandSize, AddressSize;
|
||||||
|
SOFT386_SEG_REGS Segment = SOFT386_REG_DS;
|
||||||
|
|
||||||
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
|
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
|
||||||
|
|
||||||
|
@ -6571,6 +6578,12 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeLods)
|
||||||
AddressSize = !AddressSize;
|
AddressSize = !AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (State->PrefixFlags & SOFT386_PREFIX_SEG)
|
||||||
|
{
|
||||||
|
/* Use the override segment instead of DS */
|
||||||
|
Segment = State->SegmentOverride;
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the size */
|
/* Calculate the size */
|
||||||
if (Opcode == 0xAC) DataSize = sizeof(UCHAR);
|
if (Opcode == 0xAC) DataSize = sizeof(UCHAR);
|
||||||
else DataSize = OperandSize ? sizeof(ULONG) : sizeof(USHORT);
|
else DataSize = OperandSize ? sizeof(ULONG) : sizeof(USHORT);
|
||||||
|
@ -6598,7 +6611,7 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeLods)
|
||||||
|
|
||||||
/* Read from the source operand */
|
/* Read from the source operand */
|
||||||
if (!Soft386ReadMemory(State,
|
if (!Soft386ReadMemory(State,
|
||||||
SOFT386_REG_DS,
|
Segment,
|
||||||
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
|
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
|
||||||
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
|
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
Loading…
Reference in a new issue