mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 18:56:48 +00:00
[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. svn path=/branches/ntvdm/; revision=62378
This commit is contained in:
parent
8656d3a5f6
commit
e53f7b173c
7 changed files with 37 additions and 28 deletions
|
@ -75,7 +75,7 @@ Quit:
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
/* We failed everything, stop the VDM */
|
/* We failed everything, stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -170,7 +170,7 @@ VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack)
|
||||||
Opcode[9]);
|
Opcode[9]);
|
||||||
|
|
||||||
/* Stop the VDM */
|
/* Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ VOID EmulatorSimulate(VOID)
|
||||||
CpuCallLevel, MaxCpuCallLevel);
|
CpuCallLevel, MaxCpuCallLevel);
|
||||||
|
|
||||||
/* Stop the VDM */
|
/* Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CpuCallLevel++;
|
CpuCallLevel++;
|
||||||
|
@ -219,6 +219,12 @@ VOID EmulatorUnsimulate(VOID)
|
||||||
CpuSimulate = FALSE;
|
CpuSimulate = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID EmulatorTerminate(VOID)
|
||||||
|
{
|
||||||
|
/* Stop the VDM */
|
||||||
|
VdmRunning = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
VOID EmulatorInterrupt(BYTE Number)
|
VOID EmulatorInterrupt(BYTE Number)
|
||||||
{
|
{
|
||||||
/* Call the Fast486 API */
|
/* Call the Fast486 API */
|
||||||
|
@ -236,13 +242,13 @@ VOID EmulatorSetA20(BOOLEAN Enabled)
|
||||||
A20Line = Enabled;
|
A20Line = Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
|
static VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
|
||||||
{
|
{
|
||||||
DPRINT1("NTVDM: BOP_DEBUGGER\n");
|
DPRINT1("NTVDM: BOP_DEBUGGER\n");
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID WINAPI EmulatorUnsimulateBop(LPWORD Stack)
|
static VOID WINAPI EmulatorUnsimulateBop(LPWORD Stack)
|
||||||
{
|
{
|
||||||
EmulatorUnsimulate();
|
EmulatorUnsimulate();
|
||||||
}
|
}
|
||||||
|
@ -443,7 +449,7 @@ WINAPI
|
||||||
VDDTerminateVDM(VOID)
|
VDDTerminateVDM(VOID)
|
||||||
{
|
{
|
||||||
/* Stop the VDM */
|
/* Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
PBYTE
|
PBYTE
|
||||||
|
|
|
@ -119,16 +119,19 @@ UCHAR WINAPI EmulatorIntAcknowledge
|
||||||
|
|
||||||
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack);
|
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack);
|
||||||
|
|
||||||
BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput);
|
|
||||||
VOID EmulatorExecute(WORD Segment, WORD Offset);
|
VOID EmulatorExecute(WORD Segment, WORD Offset);
|
||||||
VOID EmulatorInterrupt(BYTE Number);
|
|
||||||
VOID EmulatorInterruptSignal(VOID);
|
|
||||||
VOID EmulatorStep(VOID);
|
VOID EmulatorStep(VOID);
|
||||||
VOID EmulatorSimulate(VOID);
|
VOID EmulatorSimulate(VOID);
|
||||||
VOID EmulatorUnsimulate(VOID);
|
VOID EmulatorUnsimulate(VOID);
|
||||||
VOID EmulatorCleanup(VOID);
|
VOID EmulatorTerminate(VOID);
|
||||||
|
|
||||||
|
VOID EmulatorInterrupt(BYTE Number);
|
||||||
|
VOID EmulatorInterruptSignal(VOID);
|
||||||
VOID EmulatorSetA20(BOOLEAN Enabled);
|
VOID EmulatorSetA20(BOOLEAN Enabled);
|
||||||
|
|
||||||
|
BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput);
|
||||||
|
VOID EmulatorCleanup(VOID);
|
||||||
|
|
||||||
#endif // _EMULATOR_H_
|
#endif // _EMULATOR_H_
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -214,8 +214,8 @@ static VOID WINAPI PS2WritePort(ULONG Port, BYTE Data)
|
||||||
case 0xFC:
|
case 0xFC:
|
||||||
case 0xFE:
|
case 0xFE:
|
||||||
{
|
{
|
||||||
/* Stop the simulation */
|
/* Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,8 +243,8 @@ static VOID WINAPI PS2WritePort(ULONG Port, BYTE Data)
|
||||||
/* Check if bit 0 is unset */
|
/* Check if bit 0 is unset */
|
||||||
if (!(Data & (1 << 0)))
|
if (!(Data & (1 << 0)))
|
||||||
{
|
{
|
||||||
/* CPU disabled - end simulation */
|
/* CPU disabled - Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the A20 line setting */
|
/* Update the A20 line setting */
|
||||||
|
|
|
@ -450,7 +450,7 @@ static BOOL VgaAttachToConsole(PCOORD Resolution)
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
DisplayMessage(L"RegisterConsoleVDM failed with error %d\n", GetLastError());
|
DisplayMessage(L"RegisterConsoleVDM failed with error %d\n", GetLastError());
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,7 +982,7 @@ static BOOL VgaEnterTextMode(PCOORD Resolution)
|
||||||
if (!VgaAttachToConsole(Resolution))
|
if (!VgaAttachToConsole(Resolution))
|
||||||
{
|
{
|
||||||
DisplayMessage(L"An unexpected error occurred!\n");
|
DisplayMessage(L"An unexpected error occurred!\n");
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ static VOID VgaChangeMode(VOID)
|
||||||
if (!VgaEnterTextMode(&Resolution))
|
if (!VgaEnterTextMode(&Resolution))
|
||||||
{
|
{
|
||||||
DisplayMessage(L"An unexpected VGA error occurred while switching into text mode.");
|
DisplayMessage(L"An unexpected VGA error occurred while switching into text mode.");
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1055,7 +1055,7 @@ static VOID VgaChangeMode(VOID)
|
||||||
if (!VgaEnterGraphicsMode(&Resolution))
|
if (!VgaEnterGraphicsMode(&Resolution))
|
||||||
{
|
{
|
||||||
DisplayMessage(L"An unexpected VGA error occurred while switching into graphics mode.");
|
DisplayMessage(L"An unexpected VGA error occurred while switching into graphics mode.");
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,12 +124,11 @@ CreateVdmMenu(HANDLE ConOutHandle)
|
||||||
hConsoleMenu = ConsoleMenuControl(ConsoleOutput,
|
hConsoleMenu = ConsoleMenuControl(ConsoleOutput,
|
||||||
ID_SHOWHIDE_MOUSE,
|
ID_SHOWHIDE_MOUSE,
|
||||||
ID_VDM_QUIT);
|
ID_VDM_QUIT);
|
||||||
if (hConsoleMenu != NULL)
|
if (hConsoleMenu == NULL) return;
|
||||||
{
|
|
||||||
VdmMenuPos = GetMenuItemCount(hConsoleMenu);
|
VdmMenuPos = GetMenuItemCount(hConsoleMenu);
|
||||||
AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
|
AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
|
||||||
DrawMenuBar(GetConsoleWindow());
|
DrawMenuBar(GetConsoleWindow());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
@ -200,7 +199,7 @@ BOOL WINAPI ConsoleCtrlHandler(DWORD ControlType)
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
/* Stop the VDM if the user logs out or closes the console */
|
/* Stop the VDM if the user logs out or closes the console */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -256,7 +255,8 @@ DWORD WINAPI PumpConsoleInput(LPVOID Parameter)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_VDM_QUIT:
|
case ID_VDM_QUIT:
|
||||||
VdmRunning = FALSE;
|
/* Stop the VDM */
|
||||||
|
EmulatorTerminate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -188,7 +188,7 @@ Quit:
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
|
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
|
||||||
/* Stop the VDM */
|
/* Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ Quit:
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
|
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
|
||||||
/* Stop the VDM */
|
/* Stop the VDM */
|
||||||
VdmRunning = FALSE;
|
EmulatorTerminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue