Author: aandrejevic
Date: Wed Oct 9 21:48:52 2013
New Revision: 60591
URL:
http://svn.reactos.org/svn/reactos?rev=60591&view=rev
Log:
[SOFT386]
Implement an API for external segment modification.
[NTVDM]
Implement EmulatorSetRegister for NEW_EMULATOR.
Modified:
branches/ntvdm/include/reactos/libs/soft386/soft386.h
branches/ntvdm/lib/soft386/soft386.c
branches/ntvdm/subsystems/ntvdm/emulator.c
Modified: branches/ntvdm/include/reactos/libs/soft386/soft386.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/include/reactos/libs/soft…
==============================================================================
--- branches/ntvdm/include/reactos/libs/soft386/soft386.h [iso-8859-1] (original)
+++ branches/ntvdm/include/reactos/libs/soft386/soft386.h [iso-8859-1] Wed Oct 9 21:48:52
2013
@@ -369,6 +369,15 @@
NTAPI
Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset);
+VOID
+NTAPI
+Soft386SetSegment
+(
+ PSOFT386_STATE State,
+ SOFT386_SEG_REGS Segment,
+ USHORT Selector
+);
+
#endif // _SOFT386_H_
/* EOF */
Modified: branches/ntvdm/lib/soft386/soft386.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/soft386.c?rev…
==============================================================================
--- branches/ntvdm/lib/soft386/soft386.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/soft386/soft386.c [iso-8859-1] Wed Oct 9 21:48:52 2013
@@ -306,5 +306,14 @@
State->GeneralRegs[SOFT386_REG_ESP].Long = Offset;
}
+VOID
+NTAPI
+Soft386SetSegment(PSOFT386_STATE State,
+ SOFT386_SEG_REGS Segment,
+ USHORT Selector)
+{
+ /* Call the internal function */
+ Soft386LoadSegment(State, Segment, Selector);
+}
/* EOF */
Modified: branches/ntvdm/subsystems/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] Wed Oct 9 21:48:52 2013
@@ -521,16 +521,23 @@
VOID EmulatorSetRegister(ULONG Register, ULONG Value)
{
#ifndef NEW_EMULATOR
- if (Register < EMULATOR_REG_CS)
+ if (Register < EMULATOR_REG_ES)
{
EmulatorContext.state->general_reg[Register].val = Value;
}
else
{
- EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val =
(WORD)Value;
- }
-#else
- // TODO: NOT IMPLEMENTED
+ EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val =
(USHORT)Value;
+ }
+#else
+ if (Register < EMULATOR_REG_ES)
+ {
+ EmulatorContext.GeneralRegs[Register].Long = Value;
+ }
+ else
+ {
+ Soft386SetSegment(&EmulatorContext, Register - EMULATOR_REG_ES,
(USHORT)Value);
+ }
#endif
}
@@ -596,7 +603,7 @@
}
#else
/* Dump the state for debugging purposes */
- Soft386DumpState(&EmulatorContext);
+ // Soft386DumpState(&EmulatorContext);
/* Execute the next instruction */
Soft386StepInto(&EmulatorContext);