mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[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). svn path=/trunk/; revision=64741
This commit is contained in:
parent
499561d86c
commit
f4e263796c
3 changed files with 4 additions and 14 deletions
|
@ -37,9 +37,7 @@ BOOLEAN CpuRunning = FALSE;
|
||||||
|
|
||||||
/* No more than 'MaxCpuCallLevel' recursive CPU calls are allowed */
|
/* No more than 'MaxCpuCallLevel' recursive CPU calls are allowed */
|
||||||
static const INT MaxCpuCallLevel = 32;
|
static const INT MaxCpuCallLevel = 32;
|
||||||
static INT CpuCallLevel = 0;
|
static INT CpuCallLevel = 0; // == 0: CPU stopped; >= 1: CPU running or halted
|
||||||
|
|
||||||
// BOOLEAN VdmRunning = TRUE;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
LPCWSTR ExceptionName[] =
|
LPCWSTR ExceptionName[] =
|
||||||
|
@ -131,10 +129,10 @@ VOID CpuSimulate(VOID)
|
||||||
|
|
||||||
DPRINT("CpuSimulate <-- Level %d\n", CpuCallLevel);
|
DPRINT("CpuSimulate <-- Level %d\n", CpuCallLevel);
|
||||||
CpuCallLevel--;
|
CpuCallLevel--;
|
||||||
if (CpuCallLevel < 0) CpuCallLevel = 0;
|
if (!VdmRunning || CpuCallLevel < 0) CpuCallLevel = 0;
|
||||||
|
|
||||||
/* This takes into account for reentrance */
|
/* This takes into account for reentrance */
|
||||||
CpuRunning = TRUE;
|
if (VdmRunning && (CpuCallLevel > 0)) CpuRunning = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID CpuUnsimulate(VOID)
|
VOID CpuUnsimulate(VOID)
|
||||||
|
@ -148,14 +146,6 @@ static VOID WINAPI CpuUnsimulateBop(LPWORD Stack)
|
||||||
CpuUnsimulate();
|
CpuUnsimulate();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
VOID EmulatorTerminate(VOID)
|
|
||||||
{
|
|
||||||
/* Stop the VDM */
|
|
||||||
VdmRunning = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
BOOLEAN CpuInitialize(VOID)
|
BOOLEAN CpuInitialize(VOID)
|
||||||
|
|
|
@ -55,7 +55,6 @@ enum
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
extern FAST486_STATE EmulatorContext;
|
extern FAST486_STATE EmulatorContext;
|
||||||
// extern BOOLEAN VdmRunning;
|
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack)
|
||||||
VOID EmulatorTerminate(VOID)
|
VOID EmulatorTerminate(VOID)
|
||||||
{
|
{
|
||||||
/* Stop the VDM */
|
/* Stop the VDM */
|
||||||
|
CpuUnsimulate(); // Halt the CPU
|
||||||
VdmRunning = FALSE;
|
VdmRunning = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue