Skip to content

Commit

Permalink
PPU Analyser: use reloc info
Browse files Browse the repository at this point in the history
Add blocks from relocations.
  • Loading branch information
Nekotekina committed Jan 26, 2021
1 parent 896dd56 commit 1ad0771
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion rpcs3/Emu/Cell/PPUAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,45 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)

std::unordered_set<u32> block_set;

// Check relocations which may involve block addresses (usually it's type 1)
for (auto& rel : this->relocs)
{
if (!vm::check_addr<4>(rel.addr))
{
continue;
}

const u32 target = vm::_ref<u32>(rel.addr);

if (target % 4 || target < start || target >= end)
{
continue;
}

switch (rel.type)
{
case 1:
case 24:
case 26:
case 27:
case 28:
case 107:
case 108:
case 109:
case 110:
{
ppu_log.notice("Added block from reloc: 0x%x (0x%x, %u)", target, rel.addr, rel.type);
block_queue.emplace_back(target, 0);
block_set.emplace(target);
continue;
}
default:
{
continue;
}
}
}

u32 exp = start;
u32 lim = end;

Expand Down Expand Up @@ -1715,7 +1754,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
funcs.emplace_back(std::move(pair.second));
}

ppu_log.notice("Block analysis: %zu blocks (%zu enqueued)", funcs.size(), block_queue.size());
ppu_log.notice("Block analysis: %zu blocks (%zu enqueued) [0x%x..0x%x]", funcs.size(), block_queue.size(), start, end);
}

void ppu_acontext::UNK(ppu_opcode_t op)
Expand Down

0 comments on commit 1ad0771

Please sign in to comment.