Skip to content

Commit

Permalink
SPU Cleanup
Browse files Browse the repository at this point in the history
SPURecompiler improved
Old SPU decoder removed
SPU Interpreters merged
  • Loading branch information
Nekotekina committed Sep 1, 2015
1 parent 58181c5 commit 817fec9
Show file tree
Hide file tree
Showing 30 changed files with 6,104 additions and 8,248 deletions.
2 changes: 1 addition & 1 deletion asmjit
22 changes: 10 additions & 12 deletions rpcs3/Emu/Cell/RawSPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

#include "Emu/Cell/RawSPUThread.h"

// Originally, SPU MFC registers are accessed externally in a concurrent manner (don't mix with channels, SPU MFC channels are isolated)
thread_local spu_mfc_arg_t raw_spu_mfc[8] = {};

RawSPUThread::RawSPUThread(const std::string& name, u32 index)
: SPUThread(CPU_THREAD_RAW_SPU, name, COPY_EXPR(fmt::format("RawSPU%d[0x%x] Thread (%s)[0x%08x]", index, m_id, m_name.c_str(), PC)), index, RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index)
: SPUThread(CPU_THREAD_RAW_SPU, name, COPY_EXPR(fmt::format("RawSPU[%d] Thread (0x%x)[0x%05x]", index, m_id, pc)), index, RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index)
{
if (!vm::falloc(offset, 0x40000))
{
Expand Down Expand Up @@ -45,13 +46,11 @@ bool RawSPUThread::read_reg(const u32 addr, u32& value)

case SPU_Out_MBox_offs:
{
bool notify;
value = ch_out_mbox.pop();

std::tie(value, notify) = ch_out_mbox.pop();

if (notify)
if (ch_out_mbox.notification_required)
{
// notify if necessary
// lock for reliable notification
std::lock_guard<std::mutex> lock(mutex);

cv.notify_one();
Expand Down Expand Up @@ -170,15 +169,14 @@ bool RawSPUThread::write_reg(const u32 addr, const u32 value)

case Prxy_QueryMask_offs:
{
//proxy_tag_mask = value;
return true;
}

case SPU_In_MBox_offs:
{
if (ch_in_mbox.push(value))
{
// notify if necessary
// lock for reliable notification
std::lock_guard<std::mutex> lock(mutex);

cv.notify_one();
Expand Down Expand Up @@ -238,14 +236,14 @@ bool RawSPUThread::write_reg(const u32 addr, const u32 value)
void RawSPUThread::task()
{
// get next PC and SPU Interrupt status
PC = npc.exchange(0);
pc = npc.exchange(0);

set_interrupt_status((PC & 1) != 0);
set_interrupt_status((pc & 1) != 0);

PC &= 0x3FFFC;
pc &= 0x3fffc;

SPUThread::task();

// save next PC and current SPU Interrupt status
npc.store(PC | ((ch_event_stat.load() & SPU_EVENT_INTR_ENABLED) != 0));
npc.store(pc | u32{ (ch_event_stat.load() & SPU_EVENT_INTR_ENABLED) != 0 });
}
Loading

0 comments on commit 817fec9

Please sign in to comment.