CHECK_EMU_STATUS removal

This commit is contained in:
Nekotekina 2017-02-05 17:06:03 +03:00
parent bf6854d121
commit 246b9f3182
16 changed files with 17 additions and 68 deletions

View file

@ -46,9 +46,7 @@ void cpu_thread::on_task()
// Check thread status
while (!test(state & cpu_flag::exit))
{
CHECK_EMU_STATUS;
// check stop status
// Check stop status
if (!test(state & cpu_flag::stop))
{
try
@ -92,14 +90,12 @@ bool cpu_thread::check_state()
{
while (true)
{
CHECK_EMU_STATUS; // check at least once
if (test(state & cpu_flag::exit))
{
return true;
}
if (!test(state & cpu_state_pause))
if (!test(state & (cpu_state_pause + cpu_flag::dbg_global_stop)))
{
break;
}

View file

@ -608,9 +608,7 @@ s32 cellAdecClose(u32 handle)
while (!adec->is_finished)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms); // hack
thread_ctrl::wait_for(1000); // hack
}
idm::remove<ppu_thread>(handle);

View file

@ -738,8 +738,7 @@ error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr<char
while (!result)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms);
thread_ctrl::wait_for(1000);
}
return CELL_OK;

View file

@ -118,8 +118,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialog
while (!result)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms);
thread_ctrl::wait_for(1000);
}
return CELL_OK;

View file

@ -37,8 +37,7 @@ s32 cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dialogPara
while (!result)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms);
thread_ctrl::wait_for(1000);
}
return CELL_OSKDIALOG_OK;

View file

@ -489,8 +489,6 @@ void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
while (true)
{
CHECK_EMU_STATUS;
if (spurs->handlerExiting)
{
CHECK_SUCCESS(CALL_FUNC(ppu, sys_lwmutex_unlock, ppu, spurs.ptr(&CellSpurs::mutex)));
@ -569,8 +567,6 @@ void _spurs::handler_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
while (true)
{
CHECK_EMU_STATUS;
if (spurs->flags1 & SF1_EXIT_IF_NO_WORK)
{
_spurs::handler_wait_ready(ppu, spurs);

View file

@ -686,11 +686,7 @@ bool spursKernelWorkloadExit(SPUThread& spu)
// SPURS kernel entry point
bool spursKernelEntry(SPUThread& spu)
{
while (true)
{
std::this_thread::sleep_for(100ms);
CHECK_EMU_STATUS;
}
thread_ctrl::eternalize();
auto ctxt = vm::_ptr<SpursKernelContext>(spu.offset + 0x100);
memset(ctxt, 0, sizeof(SpursKernelContext));
@ -934,7 +930,6 @@ void spursSysServiceMain(SPUThread& spu, u32 pollStatus)
while (true)
{
CHECK_EMU_STATUS;
// Process requests for the system service
spursSysServiceProcessRequests(spu, ctxt);
@ -977,7 +972,6 @@ void spursSysServiceMain(SPUThread& spu, u32 pollStatus)
cellSpursModulePutTrace(&pkt, ctxt->dmaTagId);
spursSysServiceIdleHandler(spu, ctxt);
CHECK_EMU_STATUS;
goto poll;
}

View file

@ -848,8 +848,6 @@ error_code _cellSyncLFQueueGetPushPointer(ppu_thread& ppu, vm::ptr<CellSyncLFQue
{
while (true)
{
CHECK_EMU_STATUS;
const auto old = queue->push1.load(); _mm_lfence();
auto push = old;
@ -1091,8 +1089,6 @@ error_code _cellSyncLFQueuePushBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> qu
while (true)
{
CHECK_EMU_STATUS;
s32 res;
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
@ -1111,7 +1107,7 @@ error_code _cellSyncLFQueuePushBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> qu
break;
}
std::this_thread::sleep_for(1ms); // hack
thread_ctrl::wait_for(1000); // hack
}
const s32 depth = queue->m_depth;
@ -1147,8 +1143,6 @@ error_code _cellSyncLFQueueGetPopPointer(ppu_thread& ppu, vm::ptr<CellSyncLFQueu
{
while (true)
{
CHECK_EMU_STATUS;
const auto old = queue->pop1.load(); _mm_lfence();
auto pop = old;
@ -1390,8 +1384,6 @@ error_code _cellSyncLFQueuePopBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> que
while (true)
{
CHECK_EMU_STATUS;
s32 res;
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
@ -1410,7 +1402,7 @@ error_code _cellSyncLFQueuePopBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> que
break;
}
std::this_thread::sleep_for(1ms); // hack
thread_ctrl::wait_for(1000); // hack
}
const s32 depth = queue->m_depth;

View file

@ -234,7 +234,7 @@ s32 cellSysutilCheckCallback(ppu_thread& ppu)
return res;
}
CHECK_EMU_STATUS;
thread_ctrl::test();
}
return CELL_OK;

View file

@ -333,11 +333,9 @@ struct surmixer_thread : ppu_thread
while (port.state != audio_port_state::closed)
{
CHECK_EMU_STATUS;
if (g_surmx.mixcount > (port.tag + 0)) // adding positive value (1-15): preemptive buffer filling (hack)
{
std::this_thread::sleep_for(1ms); // hack
thread_ctrl::wait_for(1000); // hack
continue;
}

View file

@ -20,8 +20,6 @@
#include <cmath>
#include <cfenv>
#include <thread>
#include <mutex>
extern u64 get_timebased_time();
@ -1061,7 +1059,7 @@ bool SPUThread::stop_and_signal(u32 code)
{
case 0x001:
{
std::this_thread::sleep_for(1ms); // hack
thread_ctrl::wait_for(1000); // hack
return true;
}

View file

@ -21,8 +21,6 @@
#include "sys_fs.h"
#include "sys_process.h"
#include <thread>
namespace vm { using namespace ps3; }
logs::channel sys_process("sys_process", logs::level::notice);
@ -51,20 +49,13 @@ s32 sys_process_exit(s32 status)
{
sys_process.warning("sys_process_exit(status=0x%x)", status);
CHECK_EMU_STATUS;
Emu.CallAfter([]()
{
sys_process.success("Process finished");
Emu.Stop();
});
while (true)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms);
}
thread_ctrl::eternalize();
return CELL_OK;
}

View file

@ -524,9 +524,9 @@ error_code sys_spu_thread_group_join(u32 id, vm::ptr<u32> cause, vm::ptr<u32> st
break;
}
CHECK_EMU_STATUS;
// TODO
group->cv.wait(lock, 1000);
thread_ctrl::test();
}
switch (group->join_state & ~SPU_TGJSF_IS_JOINING)

View file

@ -177,8 +177,6 @@ namespace sce_libc_func
{
sceLibc.warning("exit()");
CHECK_EMU_STATUS;
for (auto& func : decltype(g_atexit)(std::move(g_atexit)))
{
func(cpu);
@ -191,12 +189,7 @@ namespace sce_libc_func
Emu.Stop();
});
while (true)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms);
}
thread_ctrl::eternalize();
}
void printf(ARMv7Thread& cpu, vm::cptr<char> fmt, arm_va_args_t va_args)

View file

@ -388,10 +388,8 @@ namespace rsx
});
// TODO: exit condition
while (true)
while (!Emu.IsStopped())
{
CHECK_EMU_STATUS;
const u32 get = ctrl->get;
const u32 put = ctrl->put;

View file

@ -138,5 +138,3 @@ public:
};
extern Emulator Emu;
#define CHECK_EMU_STATUS if (Emu.IsStopped()) throw EmulationStopped{}