mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 14:01:25 +12:00
cpu_type removed, system_type added
cpu_state -> cpu_flag vm::stack_allocator template improved ppu_cmd type changed to enum, cmd64 type added
This commit is contained in:
parent
009ac37a7d
commit
bdeccd889f
39 changed files with 449 additions and 492 deletions
|
@ -5,38 +5,22 @@
|
|||
#include <mutex>
|
||||
|
||||
template<>
|
||||
void fmt_class_string<cpu_type>::format(std::string& out, u64 arg)
|
||||
void fmt_class_string<cpu_flag>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](auto arg)
|
||||
{
|
||||
switch (arg)
|
||||
{
|
||||
STR_CASE(cpu_type::ppu);
|
||||
STR_CASE(cpu_type::spu);
|
||||
STR_CASE(cpu_type::arm);
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
template<>
|
||||
void fmt_class_string<cpu_state>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](cpu_state f)
|
||||
format_enum(out, arg, [](cpu_flag f)
|
||||
{
|
||||
switch (f)
|
||||
{
|
||||
STR_CASE(cpu_state::stop);
|
||||
STR_CASE(cpu_state::exit);
|
||||
STR_CASE(cpu_state::suspend);
|
||||
STR_CASE(cpu_state::ret);
|
||||
STR_CASE(cpu_state::signal);
|
||||
STR_CASE(cpu_state::dbg_global_pause);
|
||||
STR_CASE(cpu_state::dbg_global_stop);
|
||||
STR_CASE(cpu_state::dbg_pause);
|
||||
STR_CASE(cpu_state::dbg_step);
|
||||
case cpu_state::__bitset_enum_max: break;
|
||||
STR_CASE(cpu_flag::stop);
|
||||
STR_CASE(cpu_flag::exit);
|
||||
STR_CASE(cpu_flag::suspend);
|
||||
STR_CASE(cpu_flag::ret);
|
||||
STR_CASE(cpu_flag::signal);
|
||||
STR_CASE(cpu_flag::dbg_global_pause);
|
||||
STR_CASE(cpu_flag::dbg_global_stop);
|
||||
STR_CASE(cpu_flag::dbg_pause);
|
||||
STR_CASE(cpu_flag::dbg_step);
|
||||
case cpu_flag::__bitset_enum_max: break;
|
||||
}
|
||||
|
||||
return unknown;
|
||||
|
@ -44,16 +28,16 @@ void fmt_class_string<cpu_state>::format(std::string& out, u64 arg)
|
|||
}
|
||||
|
||||
template<>
|
||||
void fmt_class_string<bs_t<cpu_state>>::format(std::string& out, u64 arg)
|
||||
void fmt_class_string<bs_t<cpu_flag>>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_bitset(out, arg, "[", "|", "]", &fmt_class_string<cpu_state>::format);
|
||||
format_bitset(out, arg, "[", "|", "]", &fmt_class_string<cpu_flag>::format);
|
||||
}
|
||||
|
||||
thread_local cpu_thread* g_tls_current_cpu_thread = nullptr;
|
||||
|
||||
void cpu_thread::on_task()
|
||||
{
|
||||
state -= cpu_state::exit;
|
||||
state -= cpu_flag::exit;
|
||||
|
||||
g_tls_current_cpu_thread = this;
|
||||
|
||||
|
@ -62,12 +46,12 @@ void cpu_thread::on_task()
|
|||
std::unique_lock<named_thread> lock(*this);
|
||||
|
||||
// Check thread status
|
||||
while (!test(state & cpu_state::exit))
|
||||
while (!test(state & cpu_flag::exit))
|
||||
{
|
||||
CHECK_EMU_STATUS;
|
||||
|
||||
// check stop status
|
||||
if (!test(state & cpu_state::stop))
|
||||
if (!test(state & cpu_flag::stop))
|
||||
{
|
||||
if (lock) lock.unlock();
|
||||
|
||||
|
@ -75,7 +59,7 @@ void cpu_thread::on_task()
|
|||
{
|
||||
cpu_task();
|
||||
}
|
||||
catch (cpu_state _s)
|
||||
catch (cpu_flag _s)
|
||||
{
|
||||
state += _s;
|
||||
}
|
||||
|
@ -85,7 +69,7 @@ void cpu_thread::on_task()
|
|||
throw;
|
||||
}
|
||||
|
||||
state -= cpu_state::ret;
|
||||
state -= cpu_flag::ret;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -101,7 +85,7 @@ void cpu_thread::on_task()
|
|||
|
||||
void cpu_thread::on_stop()
|
||||
{
|
||||
state += cpu_state::exit;
|
||||
state += cpu_flag::exit;
|
||||
lock_notify();
|
||||
}
|
||||
|
||||
|
@ -109,8 +93,7 @@ cpu_thread::~cpu_thread()
|
|||
{
|
||||
}
|
||||
|
||||
cpu_thread::cpu_thread(cpu_type type)
|
||||
: type(type)
|
||||
cpu_thread::cpu_thread()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -122,7 +105,7 @@ bool cpu_thread::check_state()
|
|||
{
|
||||
CHECK_EMU_STATUS; // check at least once
|
||||
|
||||
if (test(state & cpu_state::exit))
|
||||
if (test(state & cpu_flag::exit))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -143,15 +126,15 @@ bool cpu_thread::check_state()
|
|||
|
||||
const auto state_ = state.load();
|
||||
|
||||
if (test(state_, cpu_state::ret + cpu_state::stop))
|
||||
if (test(state_, cpu_flag::ret + cpu_flag::stop))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (test(state_, cpu_state::dbg_step))
|
||||
if (test(state_, cpu_flag::dbg_step))
|
||||
{
|
||||
state += cpu_state::dbg_pause;
|
||||
state -= cpu_state::dbg_step;
|
||||
state += cpu_flag::dbg_pause;
|
||||
state -= cpu_flag::dbg_step;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -159,6 +142,6 @@ bool cpu_thread::check_state()
|
|||
|
||||
void cpu_thread::run()
|
||||
{
|
||||
state -= cpu_state::stop;
|
||||
state -= cpu_flag::stop;
|
||||
lock_notify();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue