Author: hbelusca Date: Tue Oct 14 00:14:56 2014 New Revision: 64741
URL: http://svn.reactos.org/svn/reactos?rev=64741&view=rev Log: [NTVDM] - Call CpuUnsimulate in EmulatorTerminate so that we really stop the CPU, before stopping the rest of the VM. - We can reset CpuRunning to TRUE in CpuSimulate *only* if the VM is still running AND the CpuCallLevel is strictly positive (>=1 means, CPU halted or running; ==0 means, CPU stopped).
Modified: trunk/reactos/subsystems/ntvdm/cpu/cpu.c trunk/reactos/subsystems/ntvdm/cpu/cpu.h trunk/reactos/subsystems/ntvdm/emulator.c
Modified: trunk/reactos/subsystems/ntvdm/cpu/cpu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/cpu/cpu.c?... ============================================================================== --- trunk/reactos/subsystems/ntvdm/cpu/cpu.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/cpu/cpu.c [iso-8859-1] Tue Oct 14 00:14:56 2014 @@ -37,9 +37,7 @@
/* No more than 'MaxCpuCallLevel' recursive CPU calls are allowed */ static const INT MaxCpuCallLevel = 32; -static INT CpuCallLevel = 0; - -// BOOLEAN VdmRunning = TRUE; +static INT CpuCallLevel = 0; // == 0: CPU stopped; >= 1: CPU running or halted
#if 0 LPCWSTR ExceptionName[] = @@ -131,10 +129,10 @@
DPRINT("CpuSimulate <-- Level %d\n", CpuCallLevel); CpuCallLevel--; - if (CpuCallLevel < 0) CpuCallLevel = 0; + if (!VdmRunning || CpuCallLevel < 0) CpuCallLevel = 0;
/* This takes into account for reentrance */ - CpuRunning = TRUE; + if (VdmRunning && (CpuCallLevel > 0)) CpuRunning = TRUE; }
VOID CpuUnsimulate(VOID) @@ -147,14 +145,6 @@ { CpuUnsimulate(); } - -#if 0 -VOID EmulatorTerminate(VOID) -{ - /* Stop the VDM */ - VdmRunning = FALSE; -} -#endif
/* PUBLIC FUNCTIONS ***********************************************************/
Modified: trunk/reactos/subsystems/ntvdm/cpu/cpu.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/cpu/cpu.h?... ============================================================================== --- trunk/reactos/subsystems/ntvdm/cpu/cpu.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/cpu/cpu.h [iso-8859-1] Tue Oct 14 00:14:56 2014 @@ -55,7 +55,6 @@ }; #endif extern FAST486_STATE EmulatorContext; -// extern BOOLEAN VdmRunning;
/* FUNCTIONS ******************************************************************/
Modified: trunk/reactos/subsystems/ntvdm/emulator.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/emulator.c... ============================================================================== --- trunk/reactos/subsystems/ntvdm/emulator.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/emulator.c [iso-8859-1] Tue Oct 14 00:14:56 2014 @@ -177,6 +177,7 @@ VOID EmulatorTerminate(VOID) { /* Stop the VDM */ + CpuUnsimulate(); // Halt the CPU VdmRunning = FALSE; }