beq dyna_linker
/* pagefault */
mov r1, r0
- mov r2, #8
+ mov r2, #(4<<2) /* Address error (fetch) */
.size dyna_linker, .-dyna_linker
FUNCTION(exec_pagefault):
/* r1 = fault address */
/* r2 = cause */
ldr r3, [fp, #LO_reg_cop0+48] /* Status */
- mvn r6, #0xF000000F
- ldr r4, [fp, #LO_reg_cop0+16] /* Context */
- bic r6, r6, #0x0F800000
str r0, [fp, #LO_reg_cop0+56] /* EPC */
orr r3, r3, #2
str r1, [fp, #LO_reg_cop0+32] /* BadVAddr */
- bic r4, r4, r6
str r3, [fp, #LO_reg_cop0+48] /* Status */
- and r5, r6, r1, lsr #9
str r2, [fp, #LO_reg_cop0+52] /* Cause */
- and r1, r1, r6, lsl #9
- str r1, [fp, #LO_reg_cop0+40] /* EntryHi */
- orr r4, r4, r5
- str r4, [fp, #LO_reg_cop0+16] /* Context */
mov r0, #0x80000000
+ orr r0, r0, #0x80
bl get_addr_ht
mov pc, r0
.size exec_pagefault, .-exec_pagefault
and r2, r2, r10, lsr #17
add r3, fp, #LO_restore_candidate
str r10, [fp, #LO_cycle] /* PCSX cycles */
-@@ str r10, [fp, #LO_reg_cop0+36] /* Count */
+@@ str r10, [fp, #LO_reg_cop0+36] /* Count - not on PSX */
ldr r4, [r2, r3]
mov r10, lr
tst r4, r4
//printf("TRACE: count=%d next=%d (get_addr no-match %x)\n",Count,next_interupt,vaddr);
int r=new_recompile_block(vaddr);
if(r==0) return get_addr(vaddr);
- // Execute in unmapped page, generate pagefault execption
+ // generate an address error
Status|=2;
- Cause=(vaddr<<31)|0x8;
+ Cause=(vaddr<<31)|(4<<2);
EPC=(vaddr&1)?vaddr-5:vaddr;
BadVAddr=(vaddr&~1);
- Context=(Context&0xFF80000F)|((BadVAddr>>9)&0x007FFFF0);
- EntryHi=BadVAddr&0xFFFFE000;
- return get_addr_ht(0x80000000);
+ return get_addr_ht(0x80000080);
}
// Look up address in hash table first
void *get_addr_ht(u_int vaddr)
source = get_source_start(start, &pagelimit);
if (source == NULL) {
- SysPrintf("Compile at bogus memory address: %08x\n", addr);
- abort();
+ if (addr != hack_addr) {
+ SysPrintf("Compile at bogus memory address: %08x\n", addr);
+ hack_addr = addr;
+ }
+ //abort();
+ return -1;
}
/* Pass 1: disassemble */
/* Pass 10: garbage collection / free memory */
int j;
- int done=0;
+ int done = 0, ni_count = 0;
unsigned int type,op,op2;
//printf("addr = %x source = %x %x\n", addr,source,source[0]);
assert(start+i*4<pagelimit);
if (i==MAXBLOCK-1) done=1;
// Stop if we're compiling junk
- if(dops[i].itype==NI&&dops[i].opcode==0x11) {
+ if(dops[i].itype == NI && (++ni_count > 8 || dops[i].opcode == 0x11)) {
done=stop_after_jal=1;
SysPrintf("Disabled speculative precompilation\n");
}