Improve spu_thread::is_exec_code

This commit is contained in:
Eladash 2023-09-01 21:40:05 +03:00 committed by Elad Ashkenazi
parent a626ccfcad
commit 7c0d8fc29c

View file

@ -4034,10 +4034,10 @@ bool spu_thread::is_exec_code(u32 addr, std::span<const u8> ls_ptr, u32 base_add
}
const u32 addr0 = spu_branch_target(addr);
const u32 op = read_from_ptr<be_t<u32>>(ls_ptr, addr0 - base_addr);
const auto type = s_spu_itype.decode(op);
const spu_opcode_t op{read_from_ptr<be_t<u32>>(ls_ptr, addr0 - base_addr)};
const auto type = s_spu_itype.decode(op.opcode);
if (type == spu_itype::UNK || !op)
if (type == spu_itype::UNK || !op.opcode)
{
return false;
}
@ -4054,11 +4054,30 @@ bool spu_thread::is_exec_code(u32 addr, std::span<const u8> ls_ptr, u32 base_add
return false;
}
const auto results = op_branch_targets(addr, spu_opcode_t{op});
auto results = op_branch_targets(addr, op);
if (results[0] == umax)
{
break;
switch (type)
{
case spu_itype::BIZ:
case spu_itype::BINZ:
case spu_itype::BIHZ:
case spu_itype::BIHNZ:
{
results[0] = addr + 4;
break;
}
default:
{
break;
}
}
if (results[0] == umax)
{
break;
}
}
for (usz res_i = 1; res_i < results.size(); res_i++)