diff --git a/include/reactos/libs/soft386/soft386.h b/include/reactos/libs/soft386/soft386.h index 50e23a22670..f3412ea34d8 100644 --- a/include/reactos/libs/soft386/soft386.h +++ b/include/reactos/libs/soft386/soft386.h @@ -341,6 +341,10 @@ VOID NTAPI Soft386ExecuteAt(PSOFT386_STATE State, USHORT Segment, ULONG Offset); +VOID +NTAPI +Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset); + #endif // _SOFT386_H_ /* EOF */ diff --git a/lib/soft386/soft386.c b/lib/soft386/soft386.c index 76c5f58f7dc..08cba1ab942 100644 --- a/lib/soft386/soft386.c +++ b/lib/soft386/soft386.c @@ -270,4 +270,20 @@ Soft386ExecuteAt(PSOFT386_STATE State, USHORT Segment, ULONG Offset) State->InstPtr.Long = Offset; } +VOID +NTAPI +Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset) +{ + /* Load the new SS */ + if (!Soft386LoadSegment(State, SOFT386_REG_SS, Segment)) + { + /* An exception occurred, let the handler execute instead */ + return; + } + + /* Set the new SP */ + State->GeneralRegs[SOFT386_REG_ESP].Long = Offset; +} + + /* EOF */ diff --git a/subsystems/ntvdm/emulator.c b/subsystems/ntvdm/emulator.c index c41d1c646ac..6fba6da5c1c 100644 --- a/subsystems/ntvdm/emulator.c +++ b/subsystems/ntvdm/emulator.c @@ -429,7 +429,7 @@ VOID EmulatorSetStack(WORD Segment, DWORD Offset) /* Call the softx86 API */ softx86_set_stack_ptr(&EmulatorContext, Segment, Offset); #else - // TODO: NOT IMPLEMENTED + Soft386SetStack(&EmulatorContext, Segment, Offset); #endif }