mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
Small fix 2
This commit is contained in:
parent
0df3e955c8
commit
860d7bd3f1
@ -287,8 +287,8 @@ void _se_translator(unsigned int u, EXCEPTION_POINTERS* pExp)
|
||||
if (u == EXCEPTION_ACCESS_VIOLATION && addr < 0x100000000 && t)
|
||||
{
|
||||
// TODO: allow recovering from a page fault
|
||||
throw fmt::Format("Access violation: addr = 0x%x (last_syscall=0x%llx (%s))",
|
||||
(u32)addr, (u64)t->m_last_syscall, SysCalls::GetHLEFuncName((u32)t->m_last_syscall).c_str());
|
||||
throw fmt::Format("Access violation: addr = 0x%x (is_alive=%d, last_syscall=0x%llx (%s))",
|
||||
(u32)addr, t->IsAlive() ? 1 : 0, (u64)t->m_last_syscall, SysCalls::GetHLEFuncName((u32)t->m_last_syscall).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -61,8 +61,8 @@ void PPUThread::AddArgv(const std::string& arg)
|
||||
|
||||
void PPUThread::InitRegs()
|
||||
{
|
||||
const u32 pc = vm::read32(entry);
|
||||
const u32 rtoc = vm::read32(entry + 4);
|
||||
const u32 pc = entry ? vm::read32(entry) : 0;
|
||||
const u32 rtoc = entry ? vm::read32(entry + 4) : 0;
|
||||
|
||||
//ConLog.Write("entry = 0x%x", entry);
|
||||
//ConLog.Write("rtoc = 0x%x", rtoc);
|
||||
@ -226,6 +226,7 @@ u64 PPUThread::FastCall2(u64 addr, u64 rtoc)
|
||||
{
|
||||
auto old_status = m_status;
|
||||
auto old_PC = PC;
|
||||
auto old_stack = GPR[1]; // only saved and restored (may be wrong)
|
||||
auto old_rtoc = GPR[2];
|
||||
auto old_LR = LR;
|
||||
auto old_thread = GetCurrentNamedThread();
|
||||
@ -240,6 +241,7 @@ u64 PPUThread::FastCall2(u64 addr, u64 rtoc)
|
||||
|
||||
m_status = old_status;
|
||||
PC = old_PC;
|
||||
GPR[1] = old_stack;
|
||||
GPR[2] = old_rtoc;
|
||||
LR = old_LR;
|
||||
SetCurrentNamedThread(old_thread);
|
||||
|
@ -792,7 +792,6 @@ public:
|
||||
u64 FastCall2(u64 addr, u64 rtoc);
|
||||
void FastStop();
|
||||
|
||||
protected:
|
||||
virtual void DoReset() override;
|
||||
virtual void DoRun() override;
|
||||
virtual void DoPause() override;
|
||||
|
@ -556,13 +556,17 @@ void SPUThread::WriteChannel(u32 ch, const u128& r)
|
||||
m_intrtag[2].stat |= 1;
|
||||
if (CPUThread* t = Emu.GetCPU().GetThread(m_intrtag[2].thread))
|
||||
{
|
||||
if (t->GetType() == CPU_THREAD_PPU && !t->IsAlive())
|
||||
if (t->GetType() == CPU_THREAD_PPU)
|
||||
{
|
||||
if (t->IsAlive())
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "%s(%s): interrupt thread was alive", __FUNCTION__, spu_ch_name[ch]);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
PPUThread& ppu = *(PPUThread*)t;
|
||||
ppu.FastStop();
|
||||
ppu.Run();
|
||||
ppu.GPR[3] = ppu.m_interrupt_arg;
|
||||
ppu.FastCall2(ppu.PC, ppu.GPR[2]);
|
||||
ppu.FastCall2(vm::read32(ppu.entry), vm::read32(ppu.entry + 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,26 +51,17 @@ void CallbackManager::Init()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
m_cb_thread = &Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
|
||||
u32 cb_shit = Memory.MainMem.AllocAlign(8);
|
||||
vm::write32(cb_shit, Emu.m_ppu_thr_stop);
|
||||
vm::write32(cb_shit + 4, 0);
|
||||
|
||||
m_cb_thread = (PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
m_cb_thread->SetName("Callback Thread");
|
||||
m_cb_thread->SetEntry(cb_shit);
|
||||
m_cb_thread->SetPrio(1001); // ???
|
||||
m_cb_thread->SetEntry(0);
|
||||
m_cb_thread->SetPrio(1001);
|
||||
m_cb_thread->SetStackSize(0x10000);
|
||||
m_cb_thread->InitStack();
|
||||
m_cb_thread->InitRegs();
|
||||
m_cb_thread->DoRun();
|
||||
|
||||
thread cb_async_thread("CallbackManager::Async() thread", [this]()
|
||||
{
|
||||
while (Emu.IsReady())
|
||||
{
|
||||
m_cb_thread->WaitForAnySignal();
|
||||
}
|
||||
|
||||
m_cb_thread->Run();
|
||||
|
||||
SetCurrentNamedThread(m_cb_thread);
|
||||
|
||||
while (!Emu.IsStopped())
|
||||
|
@ -5,7 +5,7 @@ class CallbackManager
|
||||
{
|
||||
std::vector<std::function<s32()>> m_cb_list;
|
||||
std::vector<std::function<void()>> m_async_list;
|
||||
CPUThread* m_cb_thread;
|
||||
PPUThread* m_cb_thread;
|
||||
std::mutex m_mutex;
|
||||
|
||||
public:
|
||||
|
@ -251,10 +251,12 @@ u32 adecOpen(AudioDecoder* data)
|
||||
|
||||
adec.adecCb = (PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
adec.adecCb->SetName("Audio Decoder[" + std::to_string(adec_id) + "] Callback");
|
||||
adec.adecCb->SetEntry(0x10000);
|
||||
adec.adecCb->SetEntry(0);
|
||||
adec.adecCb->SetPrio(1001);
|
||||
adec.adecCb->SetStackSize(0x10000);
|
||||
adec.adecCb->Run();
|
||||
adec.adecCb->InitStack();
|
||||
adec.adecCb->InitRegs();
|
||||
adec.adecCb->DoRun();
|
||||
|
||||
thread t("Audio Decoder[" + std::to_string(adec_id) + "] Thread", [&]()
|
||||
{
|
||||
|
@ -299,10 +299,12 @@ u32 dmuxOpen(Demuxer* data)
|
||||
|
||||
dmux.dmuxCb = (PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
dmux.dmuxCb->SetName("Demuxer[" + std::to_string(dmux_id) + "] Callback");
|
||||
dmux.dmuxCb->SetEntry(0x10000);
|
||||
dmux.dmuxCb->SetEntry(0);
|
||||
dmux.dmuxCb->SetPrio(1001);
|
||||
dmux.dmuxCb->SetStackSize(0x10000);
|
||||
dmux.dmuxCb->Run();
|
||||
dmux.dmuxCb->InitStack();
|
||||
dmux.dmuxCb->InitRegs();
|
||||
dmux.dmuxCb->DoRun();
|
||||
|
||||
thread t("Demuxer[" + std::to_string(dmux_id) + "] Thread", [&]()
|
||||
{
|
||||
|
@ -186,10 +186,12 @@ u32 vdecOpen(VideoDecoder* data)
|
||||
|
||||
vdec.vdecCb = (PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
vdec.vdecCb->SetName("Video Decoder[" + std::to_string(vdec_id) + "] Callback");
|
||||
vdec.vdecCb->SetEntry(0x10000);
|
||||
vdec.vdecCb->SetEntry(0);
|
||||
vdec.vdecCb->SetPrio(1001);
|
||||
vdec.vdecCb->SetStackSize(0x10000);
|
||||
vdec.vdecCb->Run();
|
||||
vdec.vdecCb->InitStack();
|
||||
vdec.vdecCb->InitRegs();
|
||||
vdec.vdecCb->DoRun();
|
||||
|
||||
thread t("Video Decoder[" + std::to_string(vdec_id) + "] Thread", [&]()
|
||||
{
|
||||
|
@ -332,10 +332,12 @@ int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config)
|
||||
|
||||
PPUThread& cb_thread = *(PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
cb_thread.SetName("Surmixer Callback Thread");
|
||||
cb_thread.SetEntry(0x10000);
|
||||
cb_thread.SetEntry(0);
|
||||
cb_thread.SetPrio(1001);
|
||||
cb_thread.SetStackSize(0x10000);
|
||||
cb_thread.Run();
|
||||
cb_thread.InitStack();
|
||||
cb_thread.InitRegs();
|
||||
cb_thread.DoRun();
|
||||
|
||||
while (port.m_is_audio_port_opened)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32
|
||||
default: sys_ppu_thread.Error("sys_ppu_thread_create(): unknown flags value (0x%llx)", flags); return CELL_EPERM;
|
||||
}
|
||||
|
||||
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
PPUThread& new_thread = *(PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
|
||||
*thread_id = new_thread.GetId();
|
||||
new_thread.SetEntry(entry);
|
||||
@ -193,6 +193,12 @@ s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32
|
||||
new_thread.Run();
|
||||
new_thread.Exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
new_thread.InitStack();
|
||||
new_thread.InitRegs();
|
||||
new_thread.DoRun();
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user