From f18c0f46b9aabbbb7fc71cdbd308b6523adcb759 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 12 Jan 2011 15:59:41 +0200 Subject: [PATCH] drc: don't read readmem_dword to r0 or on dummy reads --- libpcsxcore/new_dynarec/assem_arm.c | 38 +++++++++++++-------------- libpcsxcore/new_dynarec/new_dynarec.c | 8 +++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index a22c3c0f..b6b856a6 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -2563,14 +2563,11 @@ do_readstub(int n) rth=get_reg(i_regmap,rt1[i]|64); rt=get_reg(i_regmap,rt1[i]); } -#ifdef PCSX - if(rt<0) - // assume forced dummy read - rt=get_reg(i_regmap,-1); -#endif assert(rs>=0); - assert(rt>=0); if(addr<0) addr=rt; + if(addr<0) + // assume dummy read, no alloced reg + addr=get_reg(i_regmap,-1); assert(addr>=0); int ftable=0; if(type==LOADB_STUB||type==LOADBU_STUB) @@ -2623,19 +2620,22 @@ do_readstub(int n) //if((cc=get_reg(regmap,CCREG))>=0) { // emit_loadreg(CCREG,cc); //} - if(type==LOADB_STUB) - emit_movsbl((int)&readmem_dword,rt); - if(type==LOADBU_STUB) - emit_movzbl((int)&readmem_dword,rt); - if(type==LOADH_STUB) - emit_movswl((int)&readmem_dword,rt); - if(type==LOADHU_STUB) - emit_movzwl((int)&readmem_dword,rt); - if(type==LOADW_STUB) - emit_readword((int)&readmem_dword,rt); - if(type==LOADD_STUB) { - emit_readword((int)&readmem_dword,rt); - if(rth>=0) emit_readword(((int)&readmem_dword)+4,rth); + if(itype[i]==C1LS||itype[i]==C2LS||(rt>=0&&rt1[i]!=0)) { + assert(rt>=0); + if(type==LOADB_STUB) + emit_movsbl((int)&readmem_dword,rt); + if(type==LOADBU_STUB) + emit_movzbl((int)&readmem_dword,rt); + if(type==LOADH_STUB) + emit_movswl((int)&readmem_dword,rt); + if(type==LOADHU_STUB) + emit_movzwl((int)&readmem_dword,rt); + if(type==LOADW_STUB) + emit_readword((int)&readmem_dword,rt); + if(type==LOADD_STUB) { + emit_readword((int)&readmem_dword,rt); + if(rth>=0) emit_readword(((int)&readmem_dword)+4,rth); + } } emit_jmp(stubs[n][2]); // return address } diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index cfdec432..f7f19c5f 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -2753,17 +2753,17 @@ void load_assemble(int i,struct regstat *i_regs) //if(c) printf("load_assemble: const=%x\n",(int)constmap[i][s]+offset); // FIXME: Even if the load is a NOP, we should check for pagefaults... #ifdef PCSX - if(tl<0) { - if(!c||(((u_int)constmap[i][s]+offset)>>16)==0x1f80) { + if(tl<0&&(!c||(((u_int)constmap[i][s]+offset)>>16)==0x1f80) + ||rt1[i]==0) { // could be FIFO, must perform the read + // ||dummy read assem_debug("(forced read)\n"); tl=get_reg(i_regs->regmap,-1); assert(tl>=0); - } } +#endif if(offset||s<0||c) addr=tl; else addr=s; -#endif if(tl>=0) { //assert(tl>=0); //assert(rt1[i]); -- 2.39.2