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;
assem_debug("bic %s,%s,#%d\n",regname[rt],regname[rs],imm);
output_w32(0xe3c00000|rd_rn_rm(rt,rs,0)|armval);
}else if(imm==65535) {
- #ifndef HAVE_ARMV7
+ #ifndef HAVE_ARMV6
assem_debug("bic %s,%s,#FF000000\n",regname[rt],regname[rs]);
output_w32(0xe3c00000|rd_rn_rm(rt,rs,0)|0x4FF);
assem_debug("bic %s,%s,#00FF0000\n",regname[rt],regname[rt]);
void emit_signextend16(int rs,int rt)
{
- #ifndef HAVE_ARMV7
+ #ifndef HAVE_ARMV6
emit_shlimm(rs,16,rt);
emit_sarimm(rt,16,rt);
#else
void emit_signextend8(int rs,int rt)
{
- #ifndef HAVE_ARMV7
+ #ifndef HAVE_ARMV6
emit_shlimm(rs,24,rt);
emit_sarimm(rt,24,rt);
#else
// 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);
}
#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
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
for(hr=0;hr<HOST_REGS;hr++) {
if(i_regs->regmap[hr]>=0) reglist_full|=1<<hr;
}
- reglist=reglist_full&0x100f;
+ reglist=reglist_full&CALLER_SAVE_REGS;
if (gte_handlers[c2op]!=NULL) {
need_flags=!(gte_unneeded[i+1]>>63); // +1 because of how liveness detection works
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)
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);
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);
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);
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);
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);
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);