mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 05:21:25 +12:00
SPU: Detect invalid STOP codes (code mining)
This commit is contained in:
parent
069ca214ff
commit
2930d609ea
1 changed files with 31 additions and 2 deletions
|
@ -4144,9 +4144,32 @@ bool spu_thread::is_exec_code(u32 addr, std::span<const u8> ls_ptr, u32 base_add
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == spu_itype::STOP && op.rb)
|
if (type == spu_itype::STOP)
|
||||||
{
|
{
|
||||||
return false;
|
if (op.rb)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (avoid_dead_code)
|
||||||
|
{
|
||||||
|
switch (op.opcode)
|
||||||
|
{
|
||||||
|
case SYS_SPU_THREAD_STOP_YIELD:
|
||||||
|
case SYS_SPU_THREAD_STOP_GROUP_EXIT:
|
||||||
|
case SYS_SPU_THREAD_STOP_THREAD_EXIT:
|
||||||
|
case SYS_SPU_THREAD_STOP_RECEIVE_EVENT:
|
||||||
|
case SYS_SPU_THREAD_STOP_TRY_RECEIVE_EVENT:
|
||||||
|
case SYS_SPU_THREAD_STOP_SWITCH_SYSTEM_MODULE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type & spu_itype::branch)
|
if (type & spu_itype::branch)
|
||||||
|
@ -6105,6 +6128,12 @@ bool spu_thread::stop_and_signal(u32 code)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SYS_SPU_THREAD_STOP_SWITCH_SYSTEM_MODULE:
|
||||||
|
{
|
||||||
|
fmt::throw_exception("SYS_SPU_THREAD_STOP_SWITCH_SYSTEM_MODULE (op=0x%x, Out_MBox=%s)", code, _ref<u32>(pc), ch_out_mbox);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
case SYS_SPU_THREAD_STOP_YIELD:
|
case SYS_SPU_THREAD_STOP_YIELD:
|
||||||
{
|
{
|
||||||
// SPU thread group yield (TODO)
|
// SPU thread group yield (TODO)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue