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=9ee832ef639d267f6fe7c58ccc7ffd5c826b355d;hp=51cceec40a660a4b38b7a4f56f692452d7484c88;hb=650adfd2da779ba8855623362c2900583e22931e;hpb=665f33e1e8ce2e40a7939a33075c3bce1c90790c diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index 51cceec4..9ee832ef 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -34,6 +34,12 @@ char translation_cache[1 << TARGET_SIZE_2] __attribute__((aligned(4096))); #endif +#ifndef __MACH__ +#define CALLER_SAVE_REGS 0x100f +#else +#define CALLER_SAVE_REGS 0x120f +#endif + extern int cycle_count; extern int last_count; extern int pcaddr; @@ -493,7 +499,7 @@ void alloc_reg(struct regstat *cur,int i,signed char reg) } } } - printf("This shouldn't happen (alloc_reg)");exit(1); + SysPrintf("This shouldn't happen (alloc_reg)");exit(1); } void alloc_reg64(struct regstat *cur,int i,signed char reg) @@ -659,7 +665,7 @@ void alloc_reg64(struct regstat *cur,int i,signed char reg) } } } - printf("This shouldn't happen");exit(1); + SysPrintf("This shouldn't happen");exit(1); } // Allocate a temporary register. This is done without regard to @@ -782,7 +788,7 @@ void alloc_reg_temp(struct regstat *cur,int i,signed char reg) } } } - printf("This shouldn't happen");exit(1); + SysPrintf("This shouldn't happen");exit(1); } // Allocate a specific ARM register. void alloc_arm_reg(struct regstat *cur,int i,signed char reg,char hr) @@ -899,7 +905,7 @@ u_int genjmp(u_int addr) int offset=addr-(int)out-8; if(offset<-33554432||offset>=33554432) { if (addr>2) { - printf("genjmp: out of range: %08x\n", offset); + SysPrintf("genjmp: out of range: %08x\n", offset); exit(1); } return 0; @@ -1033,7 +1039,7 @@ void emit_loadreg(int r, int hr) { #ifdef FORCE32 if(r&64) { - printf("64bit load in 32bit mode!\n"); + SysPrintf("64bit load in 32bit mode!\n"); assert(0); return; } @@ -1058,7 +1064,7 @@ void emit_storereg(int r, int hr) { #ifdef FORCE32 if(r&64) { - printf("64bit store in 32bit mode!\n"); + SysPrintf("64bit store in 32bit mode!\n"); assert(0); return; } @@ -2627,13 +2633,13 @@ static void restore_regs_all(u_int reglist) // Save registers before function call static void save_regs(u_int reglist) { - reglist&=0x100f; // only save the caller-save registers, r0-r3, r12 + reglist&=CALLER_SAVE_REGS; // only save the caller-save registers, r0-r3, r12 save_regs_all(reglist); } // Restore registers after function call static void restore_regs(u_int reglist) { - reglist&=0x100f; // only restore the caller-save registers, r0-r3, r12 + reglist&=CALLER_SAVE_REGS; restore_regs_all(reglist); } @@ -3288,7 +3294,7 @@ do_writestub(int n) emit_writeword(rt,(int)&dword); emit_writeword(r?rth:rt,(int)&dword+4); #else - printf("STORED_STUB\n"); + SysPrintf("STORED_STUB\n"); #endif } //emit_pusha(); @@ -3397,7 +3403,7 @@ inline_writestub(int type, int i, u_int addr, signed char regmap[], int target, emit_writeword(rt,(int)&dword); emit_writeword(target?rth:rt,(int)&dword+4); #else - printf("STORED_STUB\n"); + SysPrintf("STORED_STUB\n"); #endif } //emit_pusha(); @@ -3720,12 +3726,12 @@ generate_map_const(u_int addr,int reg) { #else -static int do_tlb_r() { return 0; } -static int do_tlb_r_branch() { return 0; } -static int gen_tlb_addr_r() { return 0; } -static int do_tlb_w() { return 0; } -static int do_tlb_w_branch() { return 0; } -static int gen_tlb_addr_w() { return 0; } +static int do_tlb_r(int a, ...) { return 0; } +static int do_tlb_r_branch(int a, ...) { return 0; } +static int gen_tlb_addr_r(int a, ...) { return 0; } +static int do_tlb_w(int a, ...) { return 0; } +static int do_tlb_w_branch(int a, ...) { return 0; } +static int gen_tlb_addr_w(int a, ...) { return 0; } #endif // DISABLE_TLB @@ -3993,10 +3999,16 @@ static int emit_fastpath_cmp_jump(int i,int addr,int *addr_reg_override) type=0; } else if(type==MTYPE_1F80) { // scratchpad - emit_addimm(addr,-0x1f800000,HOST_TEMPREG); - emit_cmpimm(HOST_TEMPREG,0x1000); - jaddr=(int)out; - emit_jc(0); + if (psxH == (void *)0x1f800000) { + emit_addimm(addr,-0x1f800000,HOST_TEMPREG); + emit_cmpimm(HOST_TEMPREG,0x1000); + jaddr=(int)out; + emit_jc(0); + } + else { + // do usual RAM check, jump will go to the right handler + type=0; + } } #endif @@ -4518,7 +4530,7 @@ static void c2op_assemble(int i,struct regstat *i_regs) for(hr=0;hrregmap[hr]>=0) reglist_full|=1<>63); // +1 because of how liveness detection works @@ -4531,12 +4543,12 @@ static void c2op_assemble(int i,struct regstat *i_regs) int lm = (source[i] >> 10) & 1; switch(c2op) { #ifndef DRC_DBG -#ifdef HAVE_ARMV5 case GTE_MVMVA: { +#ifdef HAVE_ARMV5 int v = (source[i] >> 15) & 3; int cv = (source[i] >> 13) & 3; int mx = (source[i] >> 17) & 3; - reglist=reglist_full&0x10ff; // +{r4-r7} + reglist=reglist_full&(CALLER_SAVE_REGS|0xf0); // +{r4-r7} c2op_prologue(c2op,reglist); /* r4,r5 = VXYZ(v) packed; r6 = &MX11(mx); r7 = &CV1(cv) */ if(v<3) @@ -4571,10 +4583,15 @@ static void c2op_assemble(int i,struct regstat *i_regs) } if(need_flags||need_ir) c2op_call_MACtoIR(lm,need_flags); +#endif +#else /* if not HAVE_ARMV5 */ + c2op_prologue(c2op,reglist); + emit_movimm(source[i],1); // opcode + emit_writeword(1,(int)&psxRegs.code); + emit_call((int)(need_flags?gte_handlers[c2op]:gte_handlers_nf[c2op])); #endif break; } -#endif /* HAVE_ARMV5 */ case GTE_OP: c2op_prologue(c2op,reglist); emit_call((int)(shift?gteOP_part_shift:gteOP_part_noshift)); @@ -5312,7 +5329,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) emit_negmi(remainder,remainder); // .. remainder for div0 case (will be negated back after jump) emit_movs(d2,HOST_TEMPREG); emit_jeq((int)out+52); // Division by zero - emit_negmi(HOST_TEMPREG,HOST_TEMPREG); + emit_negsmi(HOST_TEMPREG,HOST_TEMPREG); #ifdef HAVE_ARMV5 emit_clz(HOST_TEMPREG,quotient); emit_shl(HOST_TEMPREG,quotient,HOST_TEMPREG); @@ -5354,8 +5371,8 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) emit_shl(d2,HOST_TEMPREG,d2); #else emit_movimm(0,HOST_TEMPREG); - emit_addpl_imm(d2,1,d2); - emit_lslpls_imm(HOST_TEMPREG,1,HOST_TEMPREG); + emit_addpl_imm(HOST_TEMPREG,1,HOST_TEMPREG); + emit_lslpls_imm(d2,1,d2); emit_jns((int)out-2*4); emit_movimm(1<<31,quotient); #endif @@ -5409,7 +5426,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) assert(m2h>=0); assert(m1l>=0); assert(m2l>=0); - save_regs(0x100f); + save_regs(CALLER_SAVE_REGS); if(m1l!=0) emit_mov(m1l,0); if(m1h==0) emit_readword((int)&dynarec_local,1); else if(m1h>1) emit_mov(m1h,1); @@ -5418,7 +5435,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) if(m2h<3) emit_readword((int)&dynarec_local+m2h*4,3); else if(m2h>3) emit_mov(m2h,3); emit_call((int)&multu64); - restore_regs(0x100f); + restore_regs(CALLER_SAVE_REGS); signed char hih=get_reg(i_regs->regmap,HIREG|64); signed char hil=get_reg(i_regs->regmap,HIREG); signed char loh=get_reg(i_regs->regmap,LOREG|64); @@ -5489,7 +5506,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) assert(d2h>=0); assert(d1l>=0); assert(d2l>=0); - save_regs(0x100f); + save_regs(CALLER_SAVE_REGS); if(d1l!=0) emit_mov(d1l,0); if(d1h==0) emit_readword((int)&dynarec_local,1); else if(d1h>1) emit_mov(d1h,1); @@ -5498,7 +5515,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) if(d2h<3) emit_readword((int)&dynarec_local+d2h*4,3); else if(d2h>3) emit_mov(d2h,3); emit_call((int)&div64); - restore_regs(0x100f); + restore_regs(CALLER_SAVE_REGS); signed char hih=get_reg(i_regs->regmap,HIREG|64); signed char hil=get_reg(i_regs->regmap,HIREG); signed char loh=get_reg(i_regs->regmap,LOREG|64); @@ -5522,7 +5539,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) assert(d2h>=0); assert(d1l>=0); assert(d2l>=0); - save_regs(0x100f); + save_regs(CALLER_SAVE_REGS); if(d1l!=0) emit_mov(d1l,0); if(d1h==0) emit_readword((int)&dynarec_local,1); else if(d1h>1) emit_mov(d1h,1); @@ -5531,7 +5548,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs) if(d2h<3) emit_readword((int)&dynarec_local+d2h*4,3); else if(d2h>3) emit_mov(d2h,3); emit_call((int)&divu64); - restore_regs(0x100f); + restore_regs(CALLER_SAVE_REGS); signed char hih=get_reg(i_regs->regmap,HIREG|64); signed char hil=get_reg(i_regs->regmap,HIREG); signed char loh=get_reg(i_regs->regmap,LOREG|64);