[SOFT386]

Implement an API for external segment modification.
[NTVDM]
Implement EmulatorSetRegister for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60591
This commit is contained in:
Aleksandar Andrejevic 2013-10-09 21:48:52 +00:00
parent e9829f1830
commit aef0bf1635
3 changed files with 29 additions and 4 deletions

View file

@ -369,6 +369,15 @@ VOID
NTAPI NTAPI
Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset); Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset);
VOID
NTAPI
Soft386SetSegment
(
PSOFT386_STATE State,
SOFT386_SEG_REGS Segment,
USHORT Selector
);
#endif // _SOFT386_H_ #endif // _SOFT386_H_
/* EOF */ /* EOF */

View file

@ -306,5 +306,14 @@ Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset)
State->GeneralRegs[SOFT386_REG_ESP].Long = Offset; 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 */ /* EOF */

View file

@ -521,16 +521,23 @@ ULONG EmulatorGetProgramCounter(VOID)
VOID EmulatorSetRegister(ULONG Register, ULONG Value) VOID EmulatorSetRegister(ULONG Register, ULONG Value)
{ {
#ifndef NEW_EMULATOR #ifndef NEW_EMULATOR
if (Register < EMULATOR_REG_CS) if (Register < EMULATOR_REG_ES)
{ {
EmulatorContext.state->general_reg[Register].val = Value; EmulatorContext.state->general_reg[Register].val = Value;
} }
else else
{ {
EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val = (WORD)Value; EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val = (USHORT)Value;
} }
#else #else
// TODO: NOT IMPLEMENTED if (Register < EMULATOR_REG_ES)
{
EmulatorContext.GeneralRegs[Register].Long = Value;
}
else
{
Soft386SetSegment(&EmulatorContext, Register - EMULATOR_REG_ES, (USHORT)Value);
}
#endif #endif
} }
@ -596,7 +603,7 @@ VOID EmulatorStep(VOID)
} }
#else #else
/* Dump the state for debugging purposes */ /* Dump the state for debugging purposes */
Soft386DumpState(&EmulatorContext); // Soft386DumpState(&EmulatorContext);
/* Execute the next instruction */ /* Execute the next instruction */
Soft386StepInto(&EmulatorContext); Soft386StepInto(&EmulatorContext);