1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00
This commit is contained in:
Nekotekina 2015-04-20 02:49:13 +03:00
parent 3b26031692
commit 935302b620
4 changed files with 13 additions and 6 deletions

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
class CPUThread; class CPUThread;
class RawSPUThread;
enum CPUThreadType : unsigned char; enum CPUThreadType : unsigned char;
class CPUThreadManager class CPUThreadManager

View File

@ -681,7 +681,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
m_status = old_status; m_status = old_status;
PC = old_PC; PC = old_PC;
if (GPR[1] != old_stack) // GPR[1] shouldn't change if (GPR[1] != old_stack && !Emu.IsStopped()) // GPR[1] shouldn't change
{ {
LOG_ERROR(PPU, "PPUThread::FastCall2(0x%x,0x%x): stack inconsistency (SP=0x%llx, old=0x%llx)", addr, rtoc, GPR[1], old_stack); LOG_ERROR(PPU, "PPUThread::FastCall2(0x%x,0x%x): stack inconsistency (SP=0x%llx, old=0x%llx)", addr, rtoc, GPR[1], old_stack);
GPR[1] = old_stack; GPR[1] = old_stack;

View File

@ -693,7 +693,7 @@ namespace vm
{ {
PPUThread& context = static_cast<PPUThread&>(CPU); PPUThread& context = static_cast<PPUThread&>(CPU);
if (context.GPR[1] != addr) if (context.GPR[1] != addr && !Emu.IsStopped())
{ {
LOG_ERROR(PPU, "vm::stack_pop(*0x%x,*0x%x): stack inconsistency (SP=0x%llx)", addr, old_pos, context.GPR[1]); LOG_ERROR(PPU, "vm::stack_pop(*0x%x,*0x%x): stack inconsistency (SP=0x%llx)", addr, old_pos, context.GPR[1]);
} }
@ -713,7 +713,7 @@ namespace vm
{ {
ARMv7Context& context = static_cast<ARMv7Thread&>(CPU).context; ARMv7Context& context = static_cast<ARMv7Thread&>(CPU).context;
if (context.SP != addr) if (context.SP != addr && !Emu.IsStopped())
{ {
LOG_ERROR(ARMv7, "vm::stack_pop(*0x%x,*0x%x): stack inconsistency (SP=0x%x)", addr, old_pos, context.SP); LOG_ERROR(ARMv7, "vm::stack_pop(*0x%x,*0x%x): stack inconsistency (SP=0x%x)", addr, old_pos, context.SP);
} }

View File

@ -106,15 +106,20 @@ s32 sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u64 intrthread,
ppu.custom_task = [t, &tag, arg](PPUThread& CPU) ppu.custom_task = [t, &tag, arg](PPUThread& CPU)
{ {
auto func = vm::ptr<void(u64 arg)>::make(CPU.entry); const auto func = vm::ptr<void(u64 arg)>::make(CPU.entry);
const auto pc = vm::read32(func.addr());
const auto rtoc = vm::read32(func.addr() + 4);
std::unique_lock<std::mutex> cond_lock(tag.handler_mutex); std::unique_lock<std::mutex> cond_lock(tag.handler_mutex);
while (!Emu.IsStopped()) while (!Emu.IsStopped())
{ {
// call interrupt handler until int status is clear
if (tag.stat.read_relaxed()) if (tag.stat.read_relaxed())
{ {
func(CPU, arg); // call interrupt handler until int status is clear //func(CPU, arg);
CPU.GPR[3] = arg;
CPU.FastCall2(pc, rtoc);
} }
tag.cond.wait_for(cond_lock, std::chrono::milliseconds(1)); tag.cond.wait_for(cond_lock, std::chrono::milliseconds(1));
@ -152,5 +157,8 @@ void sys_interrupt_thread_eoi(PPUThread& CPU)
{ {
sys_interrupt.Log("sys_interrupt_thread_eoi()"); sys_interrupt.Log("sys_interrupt_thread_eoi()");
// TODO: maybe it should actually unwind the stack (ensure that all the automatic objects are finalized)?
CPU.GPR[1] = align(CPU.GetStackAddr() + CPU.GetStackSize(), 0x200) - 0x200; // supercrutch (just to hide error messages)
CPU.FastStop(); CPU.FastStop();
} }