Skip to content

Commit

Permalink
PPU Analyzer: Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 authored Sep 6, 2023
1 parent 93ac75c commit 52495c1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/PPUAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion rpcs3/Emu/Cell/PPUAnalyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/Cell/PPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion rpcs3/Emu/Cell/SPUAnalyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/Cell/SPURecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6455,7 +6455,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
{
if (last_itype != itype)
{
ifuncs[itype] = f;
ifuncs[static_cast<usz>(itype)] = f;
}

f->setCallingConv(CallingConv::GHC);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 52495c1

Please sign in to comment.