X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Fassem_arm.c;h=9c5d108905e6c03b15247d406bbbaa428f90c6b1;hp=f3f89e1e3764720acf1a9d89996854c6f7596f94;hb=f70d384d2642a085d539e37022fb7f07168926d0;hpb=cfbd3c6ee21bde6e848eafb3b7994db626b70b72 diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index f3f89e1e..9c5d1089 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -1008,6 +1008,15 @@ void emit_or_and_set_flags(int rs1,int rs2,int rt) output_w32(0xe1900000|rd_rn_rm(rt,rs1,rs2)); } +void emit_orrshl_imm(u_int rs,u_int imm,u_int rt) +{ + assert(rs<16); + assert(rt<16); + assert(imm<32); + assem_debug("orr %s,%s,%s,lsl #%d\n",regname[rt],regname[rt],regname[rs],imm); + output_w32(0xe1800000|rd_rn_rm(rt,rt,rs)|(imm<<7)); +} + void emit_orrshr_imm(u_int rs,u_int imm,u_int rt) { assert(rs<16); @@ -3405,15 +3414,11 @@ void cop0_assemble(int i,struct regstat *i_regs) assert(s>=0); emit_writeword(s,(int)&readmem_dword); wb_register(rs1[i],i_regs->regmap,i_regs->dirty,i_regs->is32); -#ifdef MUPEN64 /// FIXME +#ifdef MUPEN64 emit_addimm(FP,(int)&fake_pc-(int)&dynarec_local,0); emit_movimm((source[i]>>11)&0x1f,1); emit_writeword(0,(int)&PC); emit_writebyte(1,(int)&(fake_pc.f.r.nrd)); -#endif -#ifdef PCSX - emit_movimm(source[i],0); - emit_writeword(0,(int)&psxRegs.code); #endif if(copr==9||copr==11||copr==12||copr==13) { emit_readword((int)&last_count,ECX); @@ -3427,6 +3432,19 @@ void cop0_assemble(int i,struct regstat *i_regs) // The interrupt must be taken immediately, because a subsequent // instruction might disable interrupts again. if(copr==12||copr==13) { +#ifdef PCSX + if (is_delayslot) { + // burn cycles to cause cc_interrupt, which will + // reschedule next_interupt. Relies on CCREG from above. + assem_debug("MTC0 DS %d\n", copr); + emit_writeword(HOST_CCREG,(int)&last_count); + emit_movimm(0,HOST_CCREG); + emit_storereg(CCREG,HOST_CCREG); + emit_movimm(copr,0); + emit_call((int)pcsx_mtc0_ds); + return; + } +#endif emit_movimm(start+i*4+4,0); emit_movimm(0,1); emit_writeword(0,(int)&pcaddr); @@ -3434,7 +3452,12 @@ void cop0_assemble(int i,struct regstat *i_regs) } //else if(copr==12&&is_delayslot) emit_call((int)MTC0_R12); //else +#ifdef PCSX + emit_movimm(copr,0); + emit_call((int)pcsx_mtc0); +#else emit_call((int)MTC0); +#endif if(copr==9||copr==11||copr==12||copr==13) { emit_readword((int)&Count,HOST_CCREG); emit_readword((int)&next_interupt,ECX); @@ -3534,17 +3557,17 @@ static void cop2_get_dreg(u_int copr,signed char tl,signed char temp) emit_testimm(temp,0x8000); // do we need this? emit_andimm(temp,0xf80,temp); emit_andne_imm(temp,0,temp); - emit_shr(temp,7,tl); + emit_shrimm(temp,7,tl); emit_readword((int)®_cop2d[10],temp); emit_testimm(temp,0x8000); emit_andimm(temp,0xf80,temp); emit_andne_imm(temp,0,temp); - emit_orrshr(temp,2,tl); + emit_orrshr_imm(temp,2,tl); emit_readword((int)®_cop2d[11],temp); emit_testimm(temp,0x8000); emit_andimm(temp,0xf80,temp); emit_andne_imm(temp,0,temp); - emit_orrshl(temp,3,tl); + emit_orrshl_imm(temp,3,tl); emit_writeword(tl,(int)®_cop2d[copr]); break; default: @@ -3566,13 +3589,13 @@ static void cop2_put_dreg(u_int copr,signed char sl,signed char temp) break; case 28: emit_andimm(sl,0x001f,temp); - emit_shl(temp,7,temp); + emit_shlimm(temp,7,temp); emit_writeword(temp,(int)®_cop2d[9]); emit_andimm(sl,0x03e0,temp); - emit_shl(temp,2,temp); + emit_shlimm(temp,2,temp); emit_writeword(temp,(int)®_cop2d[10]); emit_andimm(sl,0x7c00,temp); - emit_shr(temp,3,temp); + emit_shrimm(temp,3,temp); emit_writeword(temp,(int)®_cop2d[11]); emit_writeword(sl,(int)®_cop2d[28]); break;