mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat Add atomic_t<>::try_inc GDBDebugServer is broken (needs rewrite) Removed old_thread class (former named_thread) Removed storing/rethrowing exceptions from thread Emu.Stop doesn't inject an exception anymore task_stack helper class removed thread_base simplified (no shared_from_this) thread_ctrl::spawn simplified (creates detached thread) Implemented overrideable thread detaching logic Disabled cellAdec, cellDmux, cellFsAio SPUThread renamed to spu_thread RawSPUThread removed, spu_thread used instead Disabled deriving from ppu_thread Partial support for thread renaming lv2_timer... simplified, screw it idm/fxm: butchered support for on_stop/on_init vm: improved allocation structure (added size)
This commit is contained in:
parent
8ca6c9fff0
commit
1b37e775be
82 changed files with 1820 additions and 2023 deletions
|
@ -486,9 +486,7 @@ bool Emulator::BootRsxCapture(const std::string& path)
|
|||
GetCallbacks().on_run();
|
||||
m_state = system_state::running;
|
||||
|
||||
auto&& rsxcapture = idm::make_ptr<ppu_thread, rsx::rsx_replay_thread>(std::move(frame));
|
||||
rsxcapture->run();
|
||||
|
||||
fxm::make<rsx::rsx_replay_thread>(std::move(frame));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -736,7 +734,7 @@ void Emulator::Load(bool add_only)
|
|||
// Workaround for analyser glitches
|
||||
vm::falloc(0x10000, 0xf0000, vm::main);
|
||||
|
||||
return thread_ctrl::make_shared("SPRX Loader", [this]
|
||||
return thread_ctrl::spawn("SPRX Loader", [this]
|
||||
{
|
||||
std::vector<std::string> dir_queue;
|
||||
dir_queue.emplace_back(m_path + '/');
|
||||
|
@ -744,7 +742,7 @@ void Emulator::Load(bool add_only)
|
|||
std::vector<std::pair<std::string, u64>> file_queue;
|
||||
file_queue.reserve(2000);
|
||||
|
||||
std::queue<std::shared_ptr<thread_base>> thread_queue;
|
||||
std::queue<named_thread<std::function<void()>>> thread_queue;
|
||||
const uint max_threads = std::thread::hardware_concurrency();
|
||||
|
||||
// Initialize progress dialog
|
||||
|
@ -820,12 +818,12 @@ void Emulator::Load(bool add_only)
|
|||
std::this_thread::sleep_for(10ms);
|
||||
}
|
||||
|
||||
thread_queue.emplace(thread_ctrl::make_shared("Worker " + std::to_string(thread_queue.size()), [_prx = std::move(prx)]
|
||||
thread_queue.emplace("Worker " + std::to_string(thread_queue.size()), [_prx = std::move(prx)]
|
||||
{
|
||||
ppu_initialize(*_prx);
|
||||
ppu_unload_prx(*_prx);
|
||||
g_progr_fdone++;
|
||||
}));
|
||||
});
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -846,7 +844,7 @@ void Emulator::Load(bool add_only)
|
|||
{
|
||||
Emu.Stop();
|
||||
});
|
||||
})->detach();
|
||||
});
|
||||
}
|
||||
|
||||
// Detect boot location
|
||||
|
@ -1237,12 +1235,12 @@ void Emulator::Run()
|
|||
|
||||
auto on_select = [](u32, cpu_thread& cpu)
|
||||
{
|
||||
cpu.run();
|
||||
cpu.state -= cpu_flag::stop;
|
||||
cpu.notify();
|
||||
};
|
||||
|
||||
idm::select<ppu_thread>(on_select);
|
||||
idm::select<RawSPUThread>(on_select);
|
||||
idm::select<SPUThread>(on_select);
|
||||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
|
||||
#ifdef WITH_GDB_DEBUGGER
|
||||
// Initialize debug server at the end of emu run sequence
|
||||
|
@ -1273,9 +1271,8 @@ bool Emulator::Pause()
|
|||
cpu.state += cpu_flag::dbg_global_pause;
|
||||
};
|
||||
|
||||
idm::select<ppu_thread>(on_select);
|
||||
idm::select<RawSPUThread>(on_select);
|
||||
idm::select<SPUThread>(on_select);
|
||||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1338,9 +1335,8 @@ void Emulator::Resume()
|
|||
cpu.notify();
|
||||
};
|
||||
|
||||
idm::select<ppu_thread>(on_select);
|
||||
idm::select<RawSPUThread>(on_select);
|
||||
idm::select<SPUThread>(on_select);
|
||||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
GetCallbacks().on_resume();
|
||||
}
|
||||
|
||||
|
@ -1369,23 +1365,14 @@ void Emulator::Stop(bool restart)
|
|||
fxm::remove<GDBDebugServer>();
|
||||
#endif
|
||||
|
||||
auto e_stop = std::make_exception_ptr(cpu_flag::dbg_global_stop);
|
||||
|
||||
auto on_select = [&](u32, cpu_thread& cpu)
|
||||
{
|
||||
cpu.state += cpu_flag::dbg_global_stop;
|
||||
|
||||
// Can't normally be null.
|
||||
// Hack for a possible vm deadlock on thread creation.
|
||||
if (auto thread = cpu.get())
|
||||
{
|
||||
thread->set_exception(e_stop);
|
||||
}
|
||||
cpu.notify();
|
||||
};
|
||||
|
||||
idm::select<ppu_thread>(on_select);
|
||||
idm::select<RawSPUThread>(on_select);
|
||||
idm::select<SPUThread>(on_select);
|
||||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
|
||||
LOG_NOTICE(GENERAL, "All threads signaled...");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue