From 24385cae1780e77722b93a972cf7f4e906688490 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 21 Nov 2010 21:40:30 +0200 Subject: [PATCH] drc: trying to make it 32bit --- libpcsxcore/new_dynarec/assem_arm.c | 18 +++++++++++++++++- libpcsxcore/new_dynarec/new_dynarec.c | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index 4af1566d..697585c1 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -2416,10 +2416,12 @@ void wb_consts(signed char i_regmap[],uint64_t i_is32,u_int i_dirty,int i) emit_movimm(value,HOST_TEMPREG); } emit_storereg(i_regmap[hr],HOST_TEMPREG); +#ifndef FORCE32 if((i_is32>>i_regmap[hr])&1) { if(value!=-1&&value!=0) emit_sarimm(HOST_TEMPREG,31,HOST_TEMPREG); emit_storereg(i_regmap[hr]|64,HOST_TEMPREG); } +#endif } } } @@ -2466,7 +2468,7 @@ emit_extjump2(int addr, int target, int linker) assert((ptr[3]&0x0e)==0xa); emit_loadlp(target,0); emit_loadlp(addr,1); - assert(addr>=0x7000000&&addr<0x7FFFFFF); + assert(addr>=BASE_ADDR&&addr<(BASE_ADDR+(1<=0x80000000&&target<0x80800000)||(target>0xA4000000&&target<0xA4001000)); //DEBUG > #ifdef DEBUG_CYCLE_COUNT @@ -2522,8 +2524,11 @@ do_readstub(int n) ftable=(int)readmemh; if(type==LOADW_STUB) ftable=(int)readmem; +#ifndef FORCE32 if(type==LOADD_STUB) ftable=(int)readmemd; +#endif + assert(ftable!=0); emit_writeword(rs,(int)&address); //emit_pusha(); save_regs(reglist); @@ -2594,8 +2599,11 @@ inline_readstub(int type, int i, u_int addr, signed char regmap[], int target, i ftable=(int)readmemh; if(type==LOADW_STUB) ftable=(int)readmem; +#ifndef FORCE32 if(type==LOADD_STUB) ftable=(int)readmemd; +#endif + assert(ftable!=0); emit_writeword(rs,(int)&address); //emit_pusha(); save_regs(reglist); @@ -2677,8 +2685,11 @@ do_writestub(int n) ftable=(int)writememh; if(type==STOREW_STUB) ftable=(int)writemem; +#ifndef FORCE32 if(type==STORED_STUB) ftable=(int)writememd; +#endif + assert(ftable!=0); emit_writeword(rs,(int)&address); //emit_shrimm(rs,16,rs); //emit_movmem_indexedx4(ftable,rs,rs); @@ -2748,8 +2759,11 @@ inline_writestub(int type, int i, u_int addr, signed char regmap[], int target, ftable=(int)writememh; if(type==STOREW_STUB) ftable=(int)writemem; +#ifndef FORCE32 if(type==STORED_STUB) ftable=(int)writememd; +#endif + assert(ftable!=0); emit_writeword(rs,(int)&address); //emit_shrimm(rs,16,rs); //emit_movmem_indexedx4(ftable,rs,rs); @@ -4288,6 +4302,7 @@ void do_miniht_insert(u_int return_address,int rt,int temp) { // as a 64-bit value later. void wb_sx(signed char pre[],signed char entry[],uint64_t dirty,uint64_t is32_pre,uint64_t is32,uint64_t u,uint64_t uu) { +#ifndef FORCE32 if(is32_pre==is32) return; int hr,reg; for(hr=0;hr>hr)&1) { if(regmap[hr]<64) { emit_storereg(r,hr); +#ifndef FORCE32 if((is32>>regmap[hr])&1) { emit_sarimm(hr,31,hr); emit_storereg(r|64,hr); } +#endif }else{ emit_storereg(r|64,hr); } @@ -4048,6 +4050,7 @@ void wb_dirtys(signed char i_regmap[],uint64_t i_is32,uint64_t i_dirty) if((i_dirty>>hr)&1) { if(i_regmap[hr]<64) { emit_storereg(i_regmap[hr],hr); +#ifndef FORCE32 if( ((i_is32>>i_regmap[hr])&1) ) { #ifdef DESTRUCTIVE_WRITEBACK emit_sarimm(hr,31,hr); @@ -4057,6 +4060,7 @@ void wb_dirtys(signed char i_regmap[],uint64_t i_is32,uint64_t i_dirty) emit_storereg(i_regmap[hr]|64,HOST_TEMPREG); #endif } +#endif }else{ if( !((i_is32>>(i_regmap[hr]&63))&1) ) { emit_storereg(i_regmap[hr],hr); @@ -4082,6 +4086,7 @@ void wb_needed_dirtys(signed char i_regmap[],uint64_t i_is32,uint64_t i_dirty,in if((i_dirty>>hr)&1) { if(i_regmap[hr]<64) { emit_storereg(i_regmap[hr],hr); +#ifndef FORCE32 if( ((i_is32>>i_regmap[hr])&1) ) { #ifdef DESTRUCTIVE_WRITEBACK emit_sarimm(hr,31,hr); @@ -4091,6 +4096,7 @@ void wb_needed_dirtys(signed char i_regmap[],uint64_t i_is32,uint64_t i_dirty,in emit_storereg(i_regmap[hr]|64,HOST_TEMPREG); #endif } +#endif }else{ if( !((i_is32>>(i_regmap[hr]&63))&1) ) { emit_storereg(i_regmap[hr],hr); @@ -6504,6 +6510,9 @@ void unneeded_registers(int istart,int iend,int r) // Save it unneeded_reg[i]=u; unneeded_reg_upper[i]=uu; +#ifdef FORCE32 + unneeded_reg_upper[i]=-1LL; +#endif /* printf("ur (%d,%d) %x: ",istart,iend,start+i*4); printf("U:"); @@ -7414,32 +7423,44 @@ void new_dynarec_init() memory_map[n]=((u_int)rdram-0x80000000)>>2; for(n=526336;n<1048576;n++) // 0x80800000 .. 0xFFFFFFFF memory_map[n]=-1; +#ifdef MUPEN64 for(n=0;n<0x8000;n++) { // 0 .. 0x7FFFFFFF writemem[n] = write_nomem_new; writememb[n] = write_nomemb_new; writememh[n] = write_nomemh_new; +#ifndef FORCE32 writememd[n] = write_nomemd_new; +#endif readmem[n] = read_nomem_new; readmemb[n] = read_nomemb_new; readmemh[n] = read_nomemh_new; +#ifndef FORCE32 readmemd[n] = read_nomemd_new; +#endif } for(n=0x8000;n<0x8080;n++) { // 0x80000000 .. 0x807FFFFF writemem[n] = write_rdram_new; writememb[n] = write_rdramb_new; writememh[n] = write_rdramh_new; +#ifndef FORCE32 writememd[n] = write_rdramd_new; +#endif } for(n=0xC000;n<0x10000;n++) { // 0xC0000000 .. 0xFFFFFFFF writemem[n] = write_nomem_new; writememb[n] = write_nomemb_new; writememh[n] = write_nomemh_new; +#ifndef FORCE32 writememd[n] = write_nomemd_new; +#endif readmem[n] = read_nomem_new; readmemb[n] = read_nomemb_new; readmemh[n] = read_nomemh_new; +#ifndef FORCE32 readmemd[n] = read_nomemd_new; +#endif } +#endif tlb_hacks(); arch_init(); } @@ -8161,6 +8182,11 @@ int new_recompile_block(int addr) current.is32=temp_is32; } } +#ifdef FORCE32 + memset(p32, 0xff, sizeof(p32)); + current.is32=-1LL; +#endif + memcpy(regmap_pre[i],current.regmap,sizeof(current.regmap)); regs[i].wasconst=current.isconst; regs[i].was32=current.is32; -- 2.39.5