PPU Analyzer: Fixup

This commit is contained in:
Elad Ashkenazi 2023-09-06 06:53:10 +03:00 committed by GitHub
parent 93ac75cddb
commit 52495c17d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View File

@ -1888,7 +1888,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
}
}
else if (u32 target0 = (test_op.aa ? 0 : target) + (type0 == ppu_itype::B ? +test_op.bt24 : +test_op.bt14);
(type0 == ppu_itype::B || ppu_itype::BC) && target0 < segs[0].addr || target0 >= segs[0].addr + segs[0].size)
(type0 == ppu_itype::B || type0 == ppu_itype::BC) && target0 < segs[0].addr || target0 >= segs[0].addr + segs[0].size)
{
// Sanity check
is_good = false;

View File

@ -265,7 +265,7 @@ struct ppu_itype
static constexpr struct branch_tag{} branch{}; // Branch Instructions
static constexpr struct trap_tag{} trap{}; // Branch Instructions
enum type
enum class type
{
UNK = 0,
@ -788,6 +788,8 @@ struct ppu_itype
TWI, // trap_tag last
};
using enum type;
// Enable address-of operator for ppu_decoder<>
friend constexpr type operator &(type value)
{

View File

@ -4721,7 +4721,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
const auto addr = ensure(reinterpret_cast<ppu_intrp_func_t>(jit->get(name)));
jit_mod.funcs.emplace_back(addr);
if (func.size == 4 & !BLR_func && *info.get_ptr<u32>(func.addr) == ppu_instructions::BLR())
if (func.size == 4 && !BLR_func && *info.get_ptr<u32>(func.addr) == ppu_instructions::BLR())
{
BLR_func = addr;
}
@ -4745,7 +4745,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
const u64 addr = reinterpret_cast<uptr>(ensure(jit_mod.funcs[index++]));
if (func.size == 4 & !BLR_func && *info.get_ptr<u32>(func.addr) == ppu_instructions::BLR())
if (func.size == 4 && !BLR_func && *info.get_ptr<u32>(func.addr) == ppu_instructions::BLR())
{
BLR_func = reinterpret_cast<ppu_intrp_func_t>(addr);
}

View File

@ -16,7 +16,7 @@ struct spu_itype
static constexpr struct xfloat_tag{} xfloat{}; // Instructions producing xfloat values
static constexpr struct zregmod_tag{} zregmod{}; // Instructions not modifying any GPR
enum type : unsigned char
enum class type : unsigned char
{
UNK = 0,
@ -236,6 +236,8 @@ struct spu_itype
CLGTI, // compare_tag last
};
using enum type;
// Enable address-of operator for spu_decoder<>
friend constexpr type operator &(type value)
{

View File

@ -6455,7 +6455,7 @@ public:
{
if (last_itype != itype)
{
ifuncs[itype] = f;
ifuncs[static_cast<usz>(itype)] = f;
}
f->setCallingConv(CallingConv::GHC);
@ -12023,7 +12023,7 @@ struct spu_fast : public spu_recompiler_base
raw += 4;
// call spu_* (specially built interpreter function)
const s64 rel = spu_runtime::g_interpreter_table[type] - reinterpret_cast<u64>(raw) - 5;
const s64 rel = spu_runtime::g_interpreter_table[static_cast<usz>(type)] - reinterpret_cast<u64>(raw) - 5;
*raw++ = 0xe8;
std::memcpy(raw, &rel, 4);
raw += 4;