Commit 6a940fde authored by Flyinghead's avatar Flyinghead
Browse files

arm64: check CpuRunning at end of each timeslice

fix hang when exiting service menu in kofnw. Issue #867
parent 11d8e45d
......@@ -19,8 +19,7 @@ ngen_LinkBlock_Generic_stub:
.hidden ngen_LinkBlock_Shared_stub
.globl ngen_LinkBlock_Shared_stub
ngen_LinkBlock_Shared_stub:
mov x0, lr
sub x0, x0, #4 // go before the call
sub x0, lr, #4 // go before the call
bl rdv_LinkBlock // returns an RX addr
br x0
......
......@@ -65,7 +65,7 @@ static jmp_buf jmp_env;
static u32 cycle_counter;
static void (*mainloop)(void *context);
static void (*arm64_intc_sched)();
static int (*arm64_intc_sched)();
static void (*arm64_no_update)();
void(*ngen_FailedToFindBlock)();
......@@ -324,6 +324,12 @@ public:
Label cycles_remaining;
B(&cycles_remaining, pl);
GenCall(*arm64_intc_sched);
Label cpu_running;
Cbnz(w0, &cpu_running);
Mov(w29, block->vaddr);
Str(w29, sh4_context_mem_operand(&next_pc));
GenBranch(*arm64_no_update);
Bind(&cpu_running);
Bind(&cycles_remaining);
for (size_t i = 0; i < block->oplist.size(); i++)
......@@ -1333,8 +1339,8 @@ public:
Label intc_sched;
Label end_mainloop;
// void intc_sched()
arm64_intc_sched = GetCursorAddress<void (*)()>();
// int intc_sched()
arm64_intc_sched = GetCursorAddress<int (*)()>();
B(&intc_sched);
// void no_update()
......@@ -1421,6 +1427,7 @@ public:
GenCallRuntime(UpdateSystem);
Mov(lr, x29);
Cbnz(w0, &do_interrupts);
Ldr(w0, MemOperand(x28, offsetof(Sh4Context, CpuRunning)));
Ret();
Bind(&do_interrupts);
......@@ -2086,7 +2093,7 @@ private:
CanonicalParamType type;
shil_param* prm;
};
vector<CC_PS> CC_pars;
std::vector<CC_PS> CC_pars;
std::vector<const WRegister*> call_regs;
std::vector<const XRegister*> call_regs64;
std::vector<const VRegister*> call_fregs;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment