diff --git a/core/hw/sh4/dyna/driver.cpp b/core/hw/sh4/dyna/driver.cpp
index 447c77ea..9baf839a 100644
--- a/core/hw/sh4/dyna/driver.cpp
+++ b/core/hw/sh4/dyna/driver.cpp
@@ -205,7 +205,6 @@ bool RuntimeBlockInfo::Setup(u32 rpc,fpscr_t rfpu_cfg)
DynarecCodeEntryPtr rdv_CompilePC(u32 blockcheck_failures)
{
u32 pc=next_pc;
- //printf("rdv_CompilePC next_pc %p\n", next_pc);
if (emit_FreeSpace()<16*1024 || pc==0x8c0000e0 || pc==0xac010000 || pc==0xac008300)
recSh4_ClearCache();
@@ -228,13 +227,13 @@ DynarecCodeEntryPtr rdv_CompilePC(u32 blockcheck_failures)
if (rbi->read_only)
INFO_LOG(DYNAREC, "WARNING: temp block %x (%x) is protected!", rbi->vaddr, rbi->addr);
}
- bool do_opts = !rbi->temp_block;
- rbi->staging_runs=do_opts?100:-100;
- bool block_check = rbi->read_only ? false : IsOnRam(rbi->addr);
- ngen_Compile(rbi, block_check, (pc & 0xFFFFFF) == 0x08300 || (pc & 0xFFFFFF) == 0x10000, false, do_opts);
- verify(rbi->code!=0);
+ bool do_opts = !rbi->temp_block;
+ rbi->staging_runs=do_opts?100:-100;
+ bool block_check = !rbi->read_only;
+ ngen_Compile(rbi, block_check, (pc & 0xFFFFFF) == 0x08300 || (pc & 0xFFFFFF) == 0x10000, false, do_opts);
+ verify(rbi->code!=0);
- bm_AddBlock(rbi);
+ bm_AddBlock(rbi);
if (emit_ptr != NULL)
{
diff --git a/core/hw/sh4/modules/ccn.cpp b/core/hw/sh4/modules/ccn.cpp
index 8a35b23f..a687120c 100644
--- a/core/hw/sh4/modules/ccn.cpp
+++ b/core/hw/sh4/modules/ccn.cpp
@@ -81,13 +81,9 @@ void CCN_CCR_write(u32 addr, u32 value)
CCN_CCR_type temp;
temp.reg_data=value;
- //what is 0xAC13DBF8 from ?
- if (temp.ICI && curr_pc!=0xAC13DBF8)
- {
+ if (temp.ICI) {
DEBUG_LOG(SH4, "Sh4: i-cache invalidation %08X", curr_pc);
- // Shikigami No Shiro II sets ICI frequently
- // No reason to flush the dynarec cache for this
- //sh4_cpu.ResetCache();
+ //Shikigami No Shiro II uses ICI frequently
if (!settings.dynarec.Enable)
icache.Invalidate();
temp.ICI = 0;
diff --git a/core/network/net_platform.h b/core/network/net_platform.h
index 6576e638..a0cb8ecb 100644
--- a/core/network/net_platform.h
+++ b/core/network/net_platform.h
@@ -1,6 +1,24 @@
-#ifndef _NET_PLATFORM_H
-#define _NET_PLATFORM_H
+/*
+ Created on: Apr 13, 2020
+ Copyright 2020 flyinghead
+
+ This file is part of flycast.
+
+ flycast is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ flycast is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with flycast. If not, see .
+ */
+#pragma once
#ifndef _WIN32
#include
#include
@@ -100,5 +118,3 @@ static inline const char *inet_ntop(int af, const void* src, char* dst, int cnt)
return dst;
}
#endif
-
-#endif
diff --git a/core/rec-cpp/rec_cpp.cpp b/core/rec-cpp/rec_cpp.cpp
index 8cd37fc2..d3b80a6e 100644
--- a/core/rec-cpp/rec_cpp.cpp
+++ b/core/rec-cpp/rec_cpp.cpp
@@ -17,9 +17,6 @@
#include "hw/sh4/dyna/shil_canonical.h"
-#define MIPS_COUNTER 0
-
-extern int mips_counter;
extern int cycle_counter;
void ngen_blockcheckfail_CC(u32 pc) {
diff --git a/core/rec-x64/rec_x64.cpp b/core/rec-x64/rec_x64.cpp
index d531bb6e..269722f2 100644
--- a/core/rec-x64/rec_x64.cpp
+++ b/core/rec-x64/rec_x64.cpp
@@ -289,10 +289,10 @@ public:
void compile(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
{
+ //printf("X86_64 compiling %08x to %p\n", block->addr, emit_GetCCPtr());
current_opid = -1;
- if (force_checks) {
- CheckBlock(block);
- }
+
+ CheckBlock(force_checks, block);
#ifdef _WIN32
sub(rsp, 0x28); // 32-byte shadow space + 8 byte alignment
@@ -1823,8 +1823,8 @@ private:
return true;
}
- void CheckBlock(RuntimeBlockInfo* block) {
- mov(call_regs[0], block->addr);
+ void CheckBlock(bool force_checks, RuntimeBlockInfo* block) {
+ mov(call_regs[0], block->addr);
// FIXME This test shouldn't be necessary
// However the decoder makes various assumptions about the current PC value, which are simply not
@@ -1837,38 +1837,42 @@ private:
jne(reinterpret_cast(&ngen_blockcheckfail));
}
- s32 sz=block->sh4_code_size;
- u32 sa=block->addr;
+ if (!force_checks)
+ return;
- while (sz > 0)
- {
- void* ptr = (void*)GetMemPtr(sa, sz > 8 ? 8 : sz);
- if (ptr)
- {
- uintptr_t uintptr = reinterpret_cast(ptr);
- mov(rax, uintptr);
+ s32 sz=block->sh4_code_size;
+ u32 sa=block->addr;
- if (sz >= 8 && !(uintptr & 7)) {
- mov(rdx, *(u64*)ptr);
- cmp(qword[rax], rdx);
- sz -= 8;
- sa += 8;
- }
- else if (sz >= 4 && !(uintptr & 3)) {
- mov(edx, *(u32*)ptr);
- cmp(dword[rax], edx);
- sz -= 4;
- sa += 4;
- }
- else {
- mov(edx, *(u16*)ptr);
- cmp(word[rax],dx);
- sz -= 2;
- sa += 2;
- }
- jne(reinterpret_cast(&ngen_blockcheckfail));
- }
- }
+ void* ptr = (void*)GetMemPtr(sa, sz > 8 ? 8 : sz);
+ if (ptr)
+ {
+ while (sz > 0)
+ {
+ uintptr_t uintptr = reinterpret_cast(ptr);
+ mov(rax, uintptr);
+
+ if (sz >= 8 && !(uintptr & 7)) {
+ mov(rdx, *(u64*)ptr);
+ cmp(qword[rax], rdx);
+ sz -= 8;
+ sa += 8;
+ }
+ else if (sz >= 4 && !(uintptr & 3)) {
+ mov(edx, *(u32*)ptr);
+ cmp(dword[rax], edx);
+ sz -= 4;
+ sa += 4;
+ }
+ else {
+ mov(edx, *(u16*)ptr);
+ cmp(word[rax],dx);
+ sz -= 2;
+ sa += 2;
+ }
+ jne(reinterpret_cast(CC_RX2RW(&ngen_blockcheckfail)));
+ ptr = (void*)GetMemPtr(sa, sz > 8 ? 8 : sz);
+ }
+ }
}
void GenBinaryOp(const shil_opcode &op, X64BinaryOp natop)
diff --git a/core/rec-x86/rec_x86_driver.cpp b/core/rec-x86/rec_x86_driver.cpp
index 1a55b325..19f3c366 100644
--- a/core/rec-x86/rec_x86_driver.cpp
+++ b/core/rec-x86/rec_x86_driver.cpp
@@ -238,7 +238,6 @@ void DYNACALL PrintBlock(u32 pc)
u32 cvld;
u32 rdmt[6];
-extern int mips_counter;
void CheckBlock(RuntimeBlockInfo* block,x86_ptr_imm place)
{
@@ -278,10 +277,6 @@ void ngen_Compile_x86(RuntimeBlockInfo* block,bool force_checks, bool reset, boo
block->code=(DynarecCodeEntryPtr)emit_GetCCPtr();
-#ifdef MIPS_COUNTER
- x86e->Emit(op_add32, &mips_counter, block->oplist.size());
-#endif
-
//run register allocator
reg.DoAlloc(block,alloc_regs,xmm_alloc_regs);