mirror of
https://github.com/holub/mame
synced 2025-06-30 07:58:56 +03:00
Revert part of 20b5f5d0e6
This commit is contained in:
parent
c295fc4daa
commit
c41cf669b8
@ -452,12 +452,7 @@ void device_scheduler::timeslice()
|
|||||||
{
|
{
|
||||||
// only process if this CPU is executing or truly halted (not yielding)
|
// only process if this CPU is executing or truly halted (not yielding)
|
||||||
// and if our target is later than the CPU's current time (coarse check)
|
// and if our target is later than the CPU's current time (coarse check)
|
||||||
if (exec->m_suspend != 0)
|
if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds()))
|
||||||
{
|
|
||||||
if (exec->m_eatcycles)
|
|
||||||
exec->m_localtime = target;
|
|
||||||
}
|
|
||||||
else if (target.seconds() >= exec->m_localtime.seconds())
|
|
||||||
{
|
{
|
||||||
// compute how many attoseconds to execute this CPU
|
// compute how many attoseconds to execute this CPU
|
||||||
attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds();
|
attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds();
|
||||||
@ -472,28 +467,32 @@ void device_scheduler::timeslice()
|
|||||||
int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor);
|
int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor);
|
||||||
LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running));
|
LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running));
|
||||||
|
|
||||||
g_profiler.start(exec->m_profiler);
|
// if we're not suspended, actually execute
|
||||||
|
if (exec->m_suspend == 0)
|
||||||
// note that this global variable cycles_stolen can be modified
|
|
||||||
// via the call to cpu_execute
|
|
||||||
exec->m_cycles_stolen = 0;
|
|
||||||
m_executing_device = exec;
|
|
||||||
*exec->m_icountptr = exec->m_cycles_running;
|
|
||||||
if (!call_debugger)
|
|
||||||
exec->run();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
exec->debugger_start_cpu_hook(target);
|
g_profiler.start(exec->m_profiler);
|
||||||
exec->run();
|
|
||||||
exec->debugger_stop_cpu_hook();
|
|
||||||
}
|
|
||||||
|
|
||||||
// adjust for any cycles we took back
|
// note that this global variable cycles_stolen can be modified
|
||||||
assert(ran >= *exec->m_icountptr);
|
// via the call to cpu_execute
|
||||||
ran -= *exec->m_icountptr;
|
exec->m_cycles_stolen = 0;
|
||||||
assert(ran >= exec->m_cycles_stolen);
|
m_executing_device = exec;
|
||||||
ran -= exec->m_cycles_stolen;
|
*exec->m_icountptr = exec->m_cycles_running;
|
||||||
g_profiler.stop();
|
if (!call_debugger)
|
||||||
|
exec->run();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exec->debugger_start_cpu_hook(target);
|
||||||
|
exec->run();
|
||||||
|
exec->debugger_stop_cpu_hook();
|
||||||
|
}
|
||||||
|
|
||||||
|
// adjust for any cycles we took back
|
||||||
|
assert(ran >= *exec->m_icountptr);
|
||||||
|
ran -= *exec->m_icountptr;
|
||||||
|
assert(ran >= exec->m_cycles_stolen);
|
||||||
|
ran -= exec->m_cycles_stolen;
|
||||||
|
g_profiler.stop();
|
||||||
|
}
|
||||||
|
|
||||||
// account for these cycles
|
// account for these cycles
|
||||||
exec->m_totalcycles += ran;
|
exec->m_totalcycles += ran;
|
||||||
|
Loading…
Reference in New Issue
Block a user