SPU debugger: Show channels data

This commit is contained in:
Eladash 2020-04-03 12:18:00 +03:00 committed by Ivan
parent 0beea91d5e
commit 13820d6802
3 changed files with 44 additions and 2 deletions

View File

@ -1027,6 +1027,16 @@ std::string spu_thread::dump_regs() const
fmt::append(ret, "r%d = %s\n", i, gpr[i]);
}
fmt::append(ret, "\nEvent Stat: 0x%x\n", +ch_event_stat);
fmt::append(ret, "Event Mask: 0x%x\n", +ch_event_mask);
fmt::append(ret, "Interrupts Enabled: %s\n", interrupts_enabled.load());
fmt::append(ret, "Inbound Mailbox: %s\n", ch_in_mbox);
fmt::append(ret, "Out Mailbox: %s\n", ch_out_mbox);
fmt::append(ret, "Out Interrupts Mailbox: %s\n", ch_out_intr_mbox);
fmt::append(ret, "SNR config: 0x%llx\n", snr_config);
fmt::append(ret, "SNR1: %s\n", ch_snr1);
fmt::append(ret, "SNR2: %s\n", ch_snr2);
return ret;
}
@ -3279,5 +3289,31 @@ void spu_thread::fast_call(u32 ls_addr)
gpr[1]._u32[3] = old_stack;
}
template <>
void fmt_class_string<spu_channel>::format(std::string& out, u64 arg)
{
const auto& ch = get_object(arg);
const u64 raw = ch.data.load();
if (raw & spu_channel::bit_count)
{
fmt::append(out, "0x%08x", static_cast<u32>(raw));
}
else
{
out += "empty";
}
}
template <>
void fmt_class_string<spu_channel_4_t>::format(std::string& out, u64 arg)
{
const auto& ch = get_object(arg);
// TODO
fmt::append(out, "count = %d", ch.get_count());
}
DECLARE(spu_thread::g_raw_spu_ctr){};
DECLARE(spu_thread::g_raw_spu_id){};

View File

@ -337,9 +337,9 @@ public:
});
}
u32 get_count()
u32 get_count() const
{
return values.raw().count;
return std::as_const(values).raw().count;
}
void set_values(u32 count, u32 value0, u32 value1 = 0, u32 value2 = 0, u32 value3 = 0)

View File

@ -707,6 +707,12 @@ public:
return m_data;
}
// Unsafe direct access
const type& raw() const
{
return m_data;
}
// Atomically compare data with cmp, replace with exch if equal, return previous data value anyway
type compare_and_swap(const type& cmp, const type& exch)
{