Author: hbelusca
Date: Sun Mar 2 14:37:51 2014
New Revision: 62378
URL:
http://svn.reactos.org/svn/reactos?rev=62378&view=rev
Log:
[NTVDM]
Use a helper function for stopping the VDM (in case we add other steps for that), instead
of just setting the flag to TRUE.
Modified:
branches/ntvdm/subsystems/ntvdm/dos/dem.c
branches/ntvdm/subsystems/ntvdm/emulator.c
branches/ntvdm/subsystems/ntvdm/emulator.h
branches/ntvdm/subsystems/ntvdm/hardware/ps2.c
branches/ntvdm/subsystems/ntvdm/hardware/vga.c
branches/ntvdm/subsystems/ntvdm/ntvdm.c
branches/ntvdm/subsystems/ntvdm/vddsup.c
Modified: branches/ntvdm/subsystems/ntvdm/dos/dem.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos/dem.…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos/dem.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos/dem.c [iso-8859-1] Sun Mar 2 14:37:51 2014
@@ -75,7 +75,7 @@
if (!Success)
{
/* We failed everything, stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
}
break;
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] Sun Mar 2 14:37:51 2014
@@ -170,7 +170,7 @@
Opcode[9]);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
@@ -198,7 +198,7 @@
CpuCallLevel, MaxCpuCallLevel);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
CpuCallLevel++;
@@ -219,6 +219,12 @@
CpuSimulate = FALSE;
}
+VOID EmulatorTerminate(VOID)
+{
+ /* Stop the VDM */
+ VdmRunning = FALSE;
+}
+
VOID EmulatorInterrupt(BYTE Number)
{
/* Call the Fast486 API */
@@ -236,13 +242,13 @@
A20Line = Enabled;
}
-VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
+static VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
{
DPRINT1("NTVDM: BOP_DEBUGGER\n");
DebugBreak();
}
-VOID WINAPI EmulatorUnsimulateBop(LPWORD Stack)
+static VOID WINAPI EmulatorUnsimulateBop(LPWORD Stack)
{
EmulatorUnsimulate();
}
@@ -443,7 +449,7 @@
VDDTerminateVDM(VOID)
{
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
}
PBYTE
Modified: branches/ntvdm/subsystems/ntvdm/emulator.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.h [iso-8859-1] Sun Mar 2 14:37:51 2014
@@ -119,15 +119,18 @@
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack);
-BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput);
VOID EmulatorExecute(WORD Segment, WORD Offset);
-VOID EmulatorInterrupt(BYTE Number);
-VOID EmulatorInterruptSignal(VOID);
VOID EmulatorStep(VOID);
VOID EmulatorSimulate(VOID);
VOID EmulatorUnsimulate(VOID);
+VOID EmulatorTerminate(VOID);
+
+VOID EmulatorInterrupt(BYTE Number);
+VOID EmulatorInterruptSignal(VOID);
+VOID EmulatorSetA20(BOOLEAN Enabled);
+
+BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput);
VOID EmulatorCleanup(VOID);
-VOID EmulatorSetA20(BOOLEAN Enabled);
#endif // _EMULATOR_H_
Modified: branches/ntvdm/subsystems/ntvdm/hardware/ps2.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/hardware/ps2.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/hardware/ps2.c [iso-8859-1] Sun Mar 2 14:37:51 2014
@@ -214,8 +214,8 @@
case 0xFC:
case 0xFE:
{
- /* Stop the simulation */
- VdmRunning = FALSE;
+ /* Stop the VDM */
+ EmulatorTerminate();
break;
}
}
@@ -243,8 +243,8 @@
/* Check if bit 0 is unset */
if (!(Data & (1 << 0)))
{
- /* CPU disabled - end simulation */
- VdmRunning = FALSE;
+ /* CPU disabled - Stop the VDM */
+ EmulatorTerminate();
}
/* Update the A20 line setting */
Modified: branches/ntvdm/subsystems/ntvdm/hardware/vga.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/hardware/vga.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/hardware/vga.c [iso-8859-1] Sun Mar 2 14:37:51 2014
@@ -450,7 +450,7 @@
if (!Success)
{
DisplayMessage(L"RegisterConsoleVDM failed with error %d\n",
GetLastError());
- VdmRunning = FALSE;
+ EmulatorTerminate();
return FALSE;
}
@@ -982,7 +982,7 @@
if (!VgaAttachToConsole(Resolution))
{
DisplayMessage(L"An unexpected error occurred!\n");
- VdmRunning = FALSE;
+ EmulatorTerminate();
return FALSE;
}
@@ -1045,7 +1045,7 @@
if (!VgaEnterTextMode(&Resolution))
{
DisplayMessage(L"An unexpected VGA error occurred while switching into
text mode.");
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
}
@@ -1055,7 +1055,7 @@
if (!VgaEnterGraphicsMode(&Resolution))
{
DisplayMessage(L"An unexpected VGA error occurred while switching into
graphics mode.");
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
}
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Sun Mar 2 14:37:51 2014
@@ -124,12 +124,11 @@
hConsoleMenu = ConsoleMenuControl(ConsoleOutput,
ID_SHOWHIDE_MOUSE,
ID_VDM_QUIT);
- if (hConsoleMenu != NULL)
- {
- VdmMenuPos = GetMenuItemCount(hConsoleMenu);
- AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
- DrawMenuBar(GetConsoleWindow());
- }
+ if (hConsoleMenu == NULL) return;
+
+ VdmMenuPos = GetMenuItemCount(hConsoleMenu);
+ AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
+ DrawMenuBar(GetConsoleWindow());
}
static VOID
@@ -200,7 +199,7 @@
default:
{
/* Stop the VDM if the user logs out or closes the console */
- VdmRunning = FALSE;
+ EmulatorTerminate();
}
}
return TRUE;
@@ -256,7 +255,8 @@
break;
case ID_VDM_QUIT:
- VdmRunning = FALSE;
+ /* Stop the VDM */
+ EmulatorTerminate();
break;
default:
Modified: branches/ntvdm/subsystems/ntvdm/vddsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/vddsup.c…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/vddsup.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/vddsup.c [iso-8859-1] Sun Mar 2 14:37:51 2014
@@ -188,7 +188,7 @@
{
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
@@ -214,7 +214,7 @@
{
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}