Merge pull request #1043 from Nekotekina/master

Stack overflow fix
This commit is contained in:
Raul Tambre 2015-03-24 19:58:31 +02:00
commit c4ec38f358
3 changed files with 17 additions and 15 deletions

View file

@ -2019,14 +2019,14 @@ void Compiler::HACK(u32 index) {
CreateBranch(nullptr, lr_i32, false, true);
}
// copied from Compiler::SC()
auto ret_i1 = Call<bool>("PollStatus", m_poll_status_function, m_state.args[CompileTaskState::Args::State]);
auto cmp_i1 = m_ir_builder->CreateICmpEQ(ret_i1, m_ir_builder->getInt1(true));
auto then_bb = GetBasicBlockFromAddress(m_state.current_instruction_address, "then_true");
auto merge_bb = GetBasicBlockFromAddress(m_state.current_instruction_address, "merge_true");
m_ir_builder->CreateCondBr(cmp_i1, then_bb, merge_bb);
m_ir_builder->SetInsertPoint(then_bb);
m_ir_builder->CreateRet(m_ir_builder->getInt32(0xFFFFFFFF));
m_ir_builder->SetInsertPoint(merge_bb);
//auto ret_i1 = Call<bool>("PollStatus", m_poll_status_function, m_state.args[CompileTaskState::Args::State]);
//auto cmp_i1 = m_ir_builder->CreateICmpEQ(ret_i1, m_ir_builder->getInt1(true));
//auto then_bb = GetBasicBlockFromAddress(m_state.current_instruction_address, "then_true");
//auto merge_bb = GetBasicBlockFromAddress(m_state.current_instruction_address, "merge_true");
//m_ir_builder->CreateCondBr(cmp_i1, then_bb, merge_bb);
//m_ir_builder->SetInsertPoint(then_bb);
//m_ir_builder->CreateRet(m_ir_builder->getInt32(0xFFFFFFFF));
//m_ir_builder->SetInsertPoint(merge_bb);
}
void Compiler::SC(u32 lev) {
@ -6087,7 +6087,9 @@ BranchType ppu_recompiler_llvm::GetBranchTypeFromInstruction(u32 instruction) {
} else if (field2 == 528) {
type = lk ? BranchType::FunctionCall : BranchType::LocalBranch;
}
} else if (field1 == 1 && (instruction & EIF_PERFORM_BLR)) {
type = BranchType::Return;
}
return type;
}

View file

@ -14,7 +14,7 @@ SysCallBase sys_interrupt("sys_interrupt");
s32 sys_interrupt_tag_destroy(u32 intrtag)
{
sys_interrupt.Warning("sys_interrupt_tag_destroy(intrtag=%d)", intrtag);
sys_interrupt.Warning("sys_interrupt_tag_destroy(intrtag=0x%x)", intrtag);
const u32 class_id = intrtag >> 8;
@ -49,7 +49,7 @@ s32 sys_interrupt_tag_destroy(u32 intrtag)
s32 sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u64 intrthread, u64 arg)
{
sys_interrupt.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.addr(), intrtag, intrthread, arg);
sys_interrupt.Warning("sys_interrupt_thread_establish(ih=*0x%x, intrtag=0x%x, intrthread=%lld, arg=0x%llx)", ih, intrtag, intrthread, arg);
const u32 class_id = intrtag >> 8;
@ -130,7 +130,7 @@ s32 sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u64 intrthread,
s32 _sys_interrupt_thread_disestablish(u32 ih, vm::ptr<u64> r13)
{
sys_interrupt.Todo("_sys_interrupt_thread_disestablish(ih=%d)", ih);
sys_interrupt.Todo("_sys_interrupt_thread_disestablish(ih=0x%x, r13=*0x%x)", ih, r13);
std::shared_ptr<interrupt_handler_t> handler;
if (!Emu.GetIdManager().GetIDData(ih, handler))
@ -147,9 +147,9 @@ s32 _sys_interrupt_thread_disestablish(u32 ih, vm::ptr<u64> r13)
return CELL_OK;
}
void sys_interrupt_thread_eoi()
void sys_interrupt_thread_eoi(PPUThread& CPU)
{
sys_interrupt.Log("sys_interrupt_thread_eoi()");
GetCurrentPPUThread().FastStop();
CPU.FastStop();
}

View file

@ -11,4 +11,4 @@ struct interrupt_handler_t
s32 sys_interrupt_tag_destroy(u32 intrtag);
s32 sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u64 intrthread, u64 arg);
s32 _sys_interrupt_thread_disestablish(u32 ih, vm::ptr<u64> r13);
void sys_interrupt_thread_eoi();
void sys_interrupt_thread_eoi(PPUThread& CPU);