diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index 33e9c8940..9f147d0ba 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -296,8 +296,8 @@ void bm_ResetCache() { RuntimeBlockInfoPtr block = it.second; block->relink_data = 0; - block->pNextBlock = 0; - block->pBranchBlock = 0; + block->pNextBlock = NULL; + block->pBranchBlock = NULL; // needed for the transition to full mmu. Could perhaps limit it to the current block. block->Relink(); // Avoid circular references @@ -312,7 +312,6 @@ void bm_ResetCache() for (auto& block_list : blocks_per_page) block_list.clear(); - // FIXME Grandia II doesn't like it. intermittent reset when pressing start (except if disabling SSA?? TBC) memset(unprotected_pages, 0, sizeof(unprotected_pages)); #ifdef DYNA_OPROF @@ -516,7 +515,7 @@ void RuntimeBlockInfo::AddRef(RuntimeBlockInfoPtr other) } void RuntimeBlockInfo::RemRef(RuntimeBlockInfoPtr other) -{ +{ bm_List::iterator it = std::find(pre_refs.begin(), pre_refs.end(), other); if (it != pre_refs.end()) pre_refs.erase(it); diff --git a/core/hw/sh4/sh4_core.h b/core/hw/sh4/sh4_core.h index f97ae5d89..a2bd09d4e 100644 --- a/core/hw/sh4/sh4_core.h +++ b/core/hw/sh4/sh4_core.h @@ -94,11 +94,6 @@ static INLINE void SetXD(u32 n,f64 val) xf[(n<<1) | 1]=t.sgl[0]; xf[(n<<1) | 0]=t.sgl[1]; } -//needs to be removed -u32* Sh4_int_GetRegisterPtr(Sh4RegType reg); -//needs to be made portable -void SetFloatStatusReg(); - bool Do_Interrupt(u32 intEvn); bool Do_Exception(u32 epc, u32 expEvn, u32 CallVect); @@ -155,9 +150,10 @@ static INLINE f64 fixNaN64(f64 f) // Reduces the precision of the argument f by a given number of bits // double have 53 bits of precision so the returned result will have a precision of 53 - bits +// Note: with -ffast-math c -(c - f) is simplified to ... f, which makes this function a nop template static INLINE double reduce_precision(double f) { - double c = (double)((1 << bits) + 1) * f; + double c = (double)((1ull << bits) + 1) * f; return c - (c - f); } diff --git a/core/hw/sh4/sh4_core_regs.cpp b/core/hw/sh4/sh4_core_regs.cpp index 0e7c230d9..c583fa7e6 100644 --- a/core/hw/sh4/sh4_core_regs.cpp +++ b/core/hw/sh4/sh4_core_regs.cpp @@ -61,7 +61,7 @@ bool UpdateSR() u32 old_rm=0xFF; u32 old_dn=0xFF; -void SetFloatStatusReg() +static void SetFloatStatusReg() { if ((old_rm!=fpscr.RM) || (old_dn!=fpscr.DN)) { @@ -150,7 +150,7 @@ void UpdateFPSCR() } -u32* Sh4_int_GetRegisterPtr(Sh4RegType reg) +static u32* Sh4_int_GetRegisterPtr(Sh4RegType reg) { if ((reg>=reg_r0) && (reg<=reg_r15)) { @@ -248,19 +248,6 @@ u32* Sh4_int_GetRegisterPtr(Sh4RegType reg) } } -u32 sh4context_offset_u32(u32 sh4_reg) -{ - void* addr=Sh4_int_GetRegisterPtr((Sh4RegType)sh4_reg); - u32 offs=(u8*)addr-(u8*)&Sh4cntx; - verify(offsvaddr); + Str(w29, sh4_context_mem_operand(&next_pc)); + GenBranch(*arm64_no_update); + Bind(&cpu_running); Bind(&cycles_remaining); #ifdef PROFILING @@ -1430,8 +1435,8 @@ public: Label intc_sched; Label end_mainloop; - // void intc_sched() - arm64_intc_sched = GetCursorAddress(); + // int intc_sched() + arm64_intc_sched = GetCursorAddress(); B(&intc_sched); // void no_update() @@ -1518,6 +1523,7 @@ public: GenCallRuntime(UpdateSystem); Mov(lr, x29); Cbnz(w0, &do_interrupts); + Ldr(w0, MemOperand(x28, offsetof(Sh4Context, CpuRunning))); Ret(); Bind(&do_interrupts);