dynarecs clean-up

move GetRegPtr and ngen_FailedToFindBlock to sh4/dyna
This commit is contained in:
Flyinghead 2019-01-11 23:52:20 +01:00
parent e5ee48efa9
commit fc05727538
11 changed files with 29 additions and 81 deletions

View File

@ -252,6 +252,12 @@ DynarecCodeEntryPtr DYNACALL rdv_FailedToFindBlock(u32 pc)
return rdv_CompilePC();
}
static void ngen_FailedToFindBlock_internal() {
rdv_FailedToFindBlock(Sh4cntx.pc);
}
void (*ngen_FailedToFindBlock)() = &ngen_FailedToFindBlock_internal;
extern u32 rebuild_counter;

View File

@ -35,9 +35,6 @@ enum shil_param_type
#define SHIL_MODE 0
#include "shil_canonical.h"
//this should be really removed ...
u32* GetRegPtr(u32 reg);
struct shil_param
{
shil_param()
@ -160,4 +157,4 @@ struct shil_opcode
const char* shil_opcode_name(int op);
string name_reg(u32 reg);
string name_reg(u32 reg);

View File

@ -254,8 +254,10 @@ int UpdateSystem()
int UpdateSystem_INTC()
{
UpdateSystem();
return UpdateINTC();
if (UpdateSystem())
return UpdateINTC();
else
return 0;
}
void sh4_int_resetcache() { }

View File

@ -260,3 +260,8 @@ u32 sh4context_offset_regtype(Sh4RegType sh4_reg)
{
return sh4context_offset_u32(sh4_reg);
}
u32* GetRegPtr(u32 reg)
{
return Sh4_int_GetRegisterPtr((Sh4RegType)reg);
}

View File

@ -354,3 +354,5 @@ s32 rcb_poffs(T* ptr)
//Get an interface to sh4 interpreter
void Get_Sh4Interpreter(sh4_if* cpu);
void Get_Sh4Recompiler(sh4_if* cpu);
u32* GetRegPtr(u32 reg);

View File

@ -197,13 +197,6 @@ typedef void BinaryOP (eReg Rd, eReg Rn, eReg Rm, ConditionCode CC);
typedef void BinaryOPImm (eReg Rd, eReg Rn, s32 sImm8, ConditionCode CC);
typedef void UnaryOP (eReg Rd, eReg Rs);
u32* GetRegPtr(u32 reg)
{
return Sh4_int_GetRegisterPtr((Sh4RegType)reg);
}
// you pick reg, loads Base with reg addr, no reg. mapping yet !
void LoadSh4Reg_mem(eReg Rt, u32 Sh4_Reg, eCC CC=CC_AL)
{
@ -343,7 +336,6 @@ extern "C" void ngen_LinkBlock_cond_Branch_stub();
extern "C" void ngen_LinkBlock_cond_Next_stub();
extern "C" void ngen_FailedToFindBlock_();
void (*ngen_FailedToFindBlock)()=&ngen_FailedToFindBlock_; // in asm
#include <map>
@ -2258,7 +2250,9 @@ void ngen_init()
verify(FPCB_OFFSET == -0x2100000 || FPCB_OFFSET == -0x4100000);
verify(rcb_noffs(p_sh4rcb->fpcb) == FPCB_OFFSET);
for (int s=0;s<6;s++)
ngen_FailedToFindBlock = &ngen_FailedToFindBlock_;
for (int s=0;s<6;s++)
{
void* fn=s==0?(void*)_vmem_ReadMem8SX32:
s==1?(void*)_vmem_ReadMem16SX32:

View File

@ -92,27 +92,6 @@ static void CacheFlush(void* start, void* end)
#endif
}
static void ngen_FailedToFindBlock_internal() {
rdv_FailedToFindBlock(Sh4cntx.pc);
}
void(*ngen_FailedToFindBlock)() = &ngen_FailedToFindBlock_internal;
extern "C" {
void *bm_GetCodeInternal(u32 pc)
{
return (void*)bm_GetCode(pc);
}
void UpdateSystemInternal(u32 pc)
{
if (UpdateSystem())
rdv_DoInterrupts_pc(pc);
}
}
void ngen_mainloop(void* v_cntx)
{
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
@ -140,14 +119,13 @@ void ngen_mainloop(void* v_cntx)
"slice_loop: \n\t"
"ldr w0, [x28, %1] \n\t" // pc
"bl bm_GetCodeInternal \n\t"
"bl bm_GetCode2 \n\t"
"blr x0 \n\t"
"cmp w27, #0 \n\t"
"b.gt slice_loop \n\t"
"add w27, w27, %2 \n\t" // SH4_TIMESLICE
"ldr w0, [x28, %1] \n\t" // pc
"bl UpdateSystemInternal \n\t"
"bl UpdateSystem_INTC \n\t"
"b run_loop \n\t"
"end_run_loop: \n\t"
@ -188,12 +166,7 @@ RuntimeBlockInfo* ngen_AllocateBlock()
return new DynaRBI();
}
u32* GetRegPtr(u32 reg)
{
return Sh4_int_GetRegisterPtr((Sh4RegType)reg);
}
void ngen_blockcheckfail(u32 pc) {
static void ngen_blockcheckfail(u32 pc) {
printf("arm64 JIT: SMC invalidation at %08X\n", pc);
rdv_BlockCheckFail(pc);
}
@ -722,14 +695,12 @@ public:
if (CCN_MMUCR.AT)
{
Mov(x9, reinterpret_cast<uintptr_t>(&do_sqw_mmu));
Ldr(x9, reinterpret_cast<uintptr_t>(&do_sqw_mmu));
}
else
{
verify(offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, do_sqw_nommu) > 0);
Sub(x9, x28, offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, do_sqw_nommu));
Ldr(x9, MemOperand(x9));
verify(offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, sq_buffer) > 0);
Sub(x1, x28, offsetof(Sh4RCB, cntx) - offsetof(Sh4RCB, sq_buffer));
}
if (!frame_reg_saved)

View File

@ -37,12 +37,6 @@ struct DynaRBI : RuntimeBlockInfo
int cycle_counter;
extern int mips_counter;
void ngen_FailedToFindBlock_internal() {
rdv_FailedToFindBlock(Sh4cntx.pc);
}
void(*ngen_FailedToFindBlock)() = &ngen_FailedToFindBlock_internal;
void ngen_mainloop(void* v_cntx)
{
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
@ -81,12 +75,7 @@ RuntimeBlockInfo* ngen_AllocateBlock()
return new DynaRBI();
}
u32* GetRegPtr(u32 reg)
{
return Sh4_int_GetRegisterPtr((Sh4RegType)reg);
}
void ngen_blockcheckfail(u32 pc) {
static void ngen_blockcheckfail(u32 pc) {
printf("REC CPP: SMC invalidation at %08X\n", pc);
rdv_BlockCheckFail(pc);
}

View File

@ -28,16 +28,8 @@ struct DynaRBI : RuntimeBlockInfo
}
};
int cycle_counter;
void ngen_FailedToFindBlock_internal() {
rdv_FailedToFindBlock(Sh4cntx.pc);
}
void(*ngen_FailedToFindBlock)() = &ngen_FailedToFindBlock_internal;
void ngen_mainloop(void* v_cntx)
{
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
@ -77,12 +69,7 @@ RuntimeBlockInfo* ngen_AllocateBlock()
return new DynaRBI();
}
u32* GetRegPtr(u32 reg)
{
return Sh4_int_GetRegisterPtr((Sh4RegType)reg);
}
void ngen_blockcheckfail(u32 pc) {
static void ngen_blockcheckfail(u32 pc) {
printf("X64 JIT: SMC invalidation at %08X\n", pc);
rdv_BlockCheckFail(pc);
}

View File

@ -62,7 +62,6 @@ naked void ngen_FailedToFindBlock_()
const u32 cpurun_offset=offsetof(Sh4RCB,cntx.CpuRunning);
const u32 nextpc_offset=offsetof(Sh4RCB,cntx.pc);
void (*ngen_FailedToFindBlock)()=&ngen_FailedToFindBlock_;
naked void ngen_mainloop(void* cntx)
{
__asm
@ -138,6 +137,5 @@ naked void DYNACALL ngen_blockcheckfail2(u32 addr)
u32 gas_offs=offsetof(Sh4RCB,cntx.jdyn);
u32 cpurun_offset=offsetof(Sh4RCB,cntx.CpuRunning);
u32 nextpc_offset=offsetof(Sh4RCB,cntx.pc);
void (*ngen_FailedToFindBlock)()=&ngen_FailedToFindBlock_;
#endif
#endif

View File

@ -257,11 +257,6 @@ void DYNACALL PrintBlock(u32 pc)
printf("\n");
}
u32* GetRegPtr(u32 reg)
{
return Sh4_int_GetRegisterPtr((Sh4RegType)reg);
}
u32 cvld;
u32 rdmt[6];
extern u32 memops_t,memops_l;
@ -763,6 +758,8 @@ void* mem_code[3][2][5];
void ngen_init()
{
ngen_FailedToFindBlock = &ngen_FailedToFindBlock_;
//Setup emitter
x86e = new x86_block();
x86e->Init(0,0);