- 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).

svn path=/trunk/; revision=64741
This commit is contained in:
Hermès Bélusca-Maïto 2014-10-14 00:14:56 +00:00
parent 499561d86c
commit f4e263796c
3 changed files with 4 additions and 14 deletions

View file

@ -37,9 +37,7 @@ BOOLEAN CpuRunning = FALSE;
/* 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 @@ VOID CpuSimulate(VOID)
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)
@ -148,14 +146,6 @@ static VOID WINAPI CpuUnsimulateBop(LPWORD Stack)
CpuUnsimulate();
}
#if 0
VOID EmulatorTerminate(VOID)
{
/* Stop the VDM */
VdmRunning = FALSE;
}
#endif
/* PUBLIC FUNCTIONS ***********************************************************/
BOOLEAN CpuInitialize(VOID)

View file

@ -55,7 +55,6 @@ enum
};
#endif
extern FAST486_STATE EmulatorContext;
// extern BOOLEAN VdmRunning;
/* FUNCTIONS ******************************************************************/

View file

@ -177,6 +177,7 @@ VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack)
VOID EmulatorTerminate(VOID)
{
/* Stop the VDM */
CpuUnsimulate(); // Halt the CPU
VdmRunning = FALSE;
}