Skip to content

Commit

Permalink
SPU debugger: Show channels data
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 authored and Nekotekina committed Apr 3, 2020
1 parent 0beea91 commit 13820d6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
36 changes: 36 additions & 0 deletions rpcs3/Emu/Cell/SPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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){};
4 changes: 2 additions & 2 deletions rpcs3/Emu/Cell/SPUThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ struct spu_channel_4_t
});
}

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)
Expand Down
6 changes: 6 additions & 0 deletions rpcs3/util/atomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ class atomic_t
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)
{
Expand Down

0 comments on commit 13820d6

Please sign in to comment.