Author: aandrejevic
Date: Wed Oct 16 03:44:06 2013
New Revision: 60689
URL:
http://svn.reactos.org/svn/reactos?rev=60689&view=rev
Log:
[SOFT386]
Allow the DS segment to overriden in LODS, MOVS and CMPS.
Modified:
branches/ntvdm/lib/soft386/opcodes.c
Modified: branches/ntvdm/lib/soft386/opcodes.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opcodes.c?rev…
==============================================================================
--- branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] Wed Oct 16 03:44:06 2013
@@ -6080,6 +6080,7 @@
{
ULONG Data, DataSize;
BOOLEAN OperandSize, AddressSize;
+ SOFT386_SEG_REGS Segment = SOFT386_REG_DS;
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
@@ -6096,6 +6097,12 @@
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
+ }
+
+ if (State->PrefixFlags & SOFT386_PREFIX_SEG)
+ {
+ /* Use the override segment instead of DS */
+ Segment = State->SegmentOverride;
}
/* Calculate the size */
@@ -6148,7 +6155,7 @@
/* Read from memory */
if (!Soft386ReadMemory(State,
- SOFT386_REG_DS,
+ Segment,
AddressSize ?
State->GeneralRegs[SOFT386_REG_ESI].Long
:
State->GeneralRegs[SOFT386_REG_ESI].LowWord,
FALSE,
@@ -6267,6 +6274,7 @@
ULONG FirstValue = 0, SecondValue = 0, Result;
ULONG DataSize, DataMask, SignFlag;
BOOLEAN OperandSize, AddressSize;
+ SOFT386_SEG_REGS Segment = SOFT386_REG_DS;
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
@@ -6285,12 +6293,10 @@
AddressSize = !AddressSize;
}
- if ((State->PrefixFlags & SOFT386_PREFIX_REP)
- || (State->PrefixFlags & SOFT386_PREFIX_REPNZ))
- {
- // TODO: The REP/REPZ/REPNZ prefixes need to be implemented!
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
- return FALSE;
+ if (State->PrefixFlags & SOFT386_PREFIX_SEG)
+ {
+ /* Use the override segment instead of DS */
+ Segment = State->SegmentOverride;
}
/* Calculate the size */
@@ -6303,7 +6309,7 @@
/* Read from the first source operand */
if (!Soft386ReadMemory(State,
- SOFT386_REG_DS,
+ Segment,
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
FALSE,
@@ -6553,6 +6559,7 @@
{
ULONG DataSize;
BOOLEAN OperandSize, AddressSize;
+ SOFT386_SEG_REGS Segment = SOFT386_REG_DS;
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
@@ -6569,6 +6576,12 @@
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
+ }
+
+ if (State->PrefixFlags & SOFT386_PREFIX_SEG)
+ {
+ /* Use the override segment instead of DS */
+ Segment = State->SegmentOverride;
}
/* Calculate the size */
@@ -6598,7 +6611,7 @@
/* Read from the source operand */
if (!Soft386ReadMemory(State,
- SOFT386_REG_DS,
+ Segment,
AddressSize ? State->GeneralRegs[SOFT386_REG_ESI].Long
: State->GeneralRegs[SOFT386_REG_ESI].LowWord,
FALSE,