/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - assem_arm.c *
- * Copyright (C) 2009-2010 Ari64 *
+ * Copyright (C) 2009-2011 Ari64 *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
}
u_int genimm(u_int imm,u_int *encoded)
{
- if(imm==0) {*encoded=0;return 1;}
+ *encoded=0;
+ if(imm==0) return 1;
int i=32;
while(i>0)
{
#ifdef FORCE32
if(r&64) {
printf("64bit load in 32bit mode!\n");
- exit(1);
+ assert(0);
+ return;
}
#endif
if((r&63)==0)
#ifdef FORCE32
if(r&64) {
printf("64bit store in 32bit mode!\n");
- exit(1);
+ assert(0);
+ return;
}
#endif
int addr=((int)reg)+((r&63)<<REG_SHIFT)+((r&64)>>4);
emit_writeword(rs,(int)&address);
//emit_pusha();
save_regs(reglist);
+#ifndef PCSX
+ if((signed int)addr>=(signed int)0xC0000000) {
+ // Theoretically we can have a pagefault here, if the TLB has never
+ // been enabled and the address is outside the range 80000000..BFFFFFFF
+ // Write out the registers so the pagefault can be handled. This is
+ // a very rare case and likely represents a bug.
+ int ds=regmap!=regs[i].regmap;
+ if(!ds) load_all_consts(regs[i].regmap_entry,regs[i].was32,regs[i].wasdirty,i);
+ if(!ds) wb_dirtys(regs[i].regmap_entry,regs[i].was32,regs[i].wasdirty);
+ else wb_dirtys(branch_regs[i-1].regmap_entry,branch_regs[i-1].was32,branch_regs[i-1].wasdirty);
+ }
+#endif
//emit_shrimm(rs,16,1);
int cc=get_reg(regmap,CCREG);
if(cc<0) {
}
//emit_pusha();
save_regs(reglist);
+#ifndef PCSX
+ // rearmed note: load_all_consts prevents BIOS boot, some bug?
+ if((signed int)addr>=(signed int)0xC0000000) {
+ // Theoretically we can have a pagefault here, if the TLB has never
+ // been enabled and the address is outside the range 80000000..BFFFFFFF
+ // Write out the registers so the pagefault can be handled. This is
+ // a very rare case and likely represents a bug.
+ int ds=regmap!=regs[i].regmap;
+ if(!ds) load_all_consts(regs[i].regmap_entry,regs[i].was32,regs[i].wasdirty,i);
+ if(!ds) wb_dirtys(regs[i].regmap_entry,regs[i].was32,regs[i].wasdirty);
+ else wb_dirtys(branch_regs[i-1].regmap_entry,branch_regs[i-1].was32,branch_regs[i-1].wasdirty);
+ }
+#endif
//emit_shrimm(rs,16,1);
int cc=get_reg(regmap,CCREG);
if(cc<0) {
int s,th,tl,temp,temp2,addr,map=-1;
int offset;
int jaddr=0;
- int memtarget,c=0;
+ int memtarget=0,c=0;
u_int hr,reglist=0;
th=get_reg(i_regs->regmap,rt1[i]|64);
tl=get_reg(i_regs->regmap,rt1[i]);
else addr=s;
if(s>=0) {
c=(i_regs->wasconst>>s)&1;
- memtarget=((signed int)(constmap[i][s]+offset))<(signed int)0x80000000+RAM_SIZE;
- if(using_tlb&&((signed int)(constmap[i][s]+offset))>=(signed int)0xC0000000) memtarget=1;
+ if(c) {
+ memtarget=((signed int)(constmap[i][s]+offset))<(signed int)0x80000000+RAM_SIZE;
+ if(using_tlb&&((signed int)(constmap[i][s]+offset))>=(signed int)0xC0000000) memtarget=1;
+ }
}
if(!using_tlb) {
if(!c) {