Skip to content

Commit 524b065

Browse files
knight4u32Ivan
authored and
Ivan
committed
Debugger: Show PPU reservation data
Asterisk marks the offset of data that had been given to the guest PPU code.
1 parent f7b55ec commit 524b065

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

rpcs3/Emu/Cell/PPUThread.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,11 +973,43 @@ std::string ppu_thread::dump_regs() const
973973
fmt::append(ret, "XER: [CA=%u | OV=%u | SO=%u | CNT=%u]\n", xer.ca, xer.ov, xer.so, xer.cnt);
974974
fmt::append(ret, "VSCR: [SAT=%u | NJ=%u]\n", sat, nj);
975975
fmt::append(ret, "FPSCR: [FL=%u | FG=%u | FE=%u | FU=%u]\n", fpscr.fl, fpscr.fg, fpscr.fe, fpscr.fu);
976-
if (const u32 addr = raddr)
976+
977+
const u32 addr = raddr;
978+
979+
if (addr)
977980
fmt::append(ret, "Reservation Addr: 0x%x", addr);
978981
else
979982
fmt::append(ret, "Reservation Addr: none");
980983

984+
fmt::append(ret, "Reservation Data (entire cache line):\n");
985+
986+
be_t<u32> data[32]{};
987+
std::memcpy(data, rdata, sizeof(rdata)); // Show the data even if the reservation was lost inside the atomic loop
988+
989+
if (addr && !use_full_rdata)
990+
{
991+
const u32 offset = addr & 0x78;
992+
993+
fmt::append(ret, "[0x%02x] %08x %08x\n", offset, data[offset / sizeof(u32)], data[offset / sizeof(u32) + 1]);
994+
995+
// Asterisk marks the offset of data that had been given to the guest PPU code
996+
*(&ret.back() - (addr & 4 ? 9 : 18)) = '*';
997+
}
998+
else
999+
{
1000+
for (usz i = 0; i < std::size(data); i += 4)
1001+
{
1002+
fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(data[0])
1003+
, data[i + 0], data[i + 1], data[i + 2], data[i + 3]);
1004+
}
1005+
1006+
if (addr)
1007+
{
1008+
// See the note above
1009+
*(&ret.back() - (4 - (addr % 16 / 4)) * 9 - (8 - (addr % 128 / 16)) * std::size("[0x00]"sv)) = '*';
1010+
}
1011+
}
1012+
9811013
return ret;
9821014
}
9831015

0 commit comments

Comments
 (0)