From: notaz Date: Sun, 30 Jan 2022 16:40:03 +0000 (+0200) Subject: drc: don't abort on game crash X-Git-Tag: r23~28 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=b4ab351d15a94065d14877b0976b4d9a7056f7ac drc: don't abort on game crash Was not the best user experience, with this the user can load another game at least. --- diff --git a/libpcsxcore/new_dynarec/emu_if.h b/libpcsxcore/new_dynarec/emu_if.h index 5a3a5e8d..7fa0a171 100644 --- a/libpcsxcore/new_dynarec/emu_if.h +++ b/libpcsxcore/new_dynarec/emu_if.h @@ -18,8 +18,6 @@ extern int reg_cop0[]; #define Cause psxRegs.CP0.n.Cause #define EPC psxRegs.CP0.n.EPC #define BadVAddr psxRegs.CP0.n.BadVAddr -#define Context psxRegs.CP0.n.Context -#define EntryHi psxRegs.CP0.n.EntryHi #define Count psxRegs.cycle // psxRegs.CP0.n.Count /* COP2/GTE */ diff --git a/libpcsxcore/new_dynarec/linkage_arm.S b/libpcsxcore/new_dynarec/linkage_arm.S index 5538462f..8d9074f4 100644 --- a/libpcsxcore/new_dynarec/linkage_arm.S +++ b/libpcsxcore/new_dynarec/linkage_arm.S @@ -264,7 +264,7 @@ FUNCTION(dyna_linker): 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): @@ -272,21 +272,13 @@ 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 @@ -440,7 +432,7 @@ FUNCTION(cc_interrupt): 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 diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index f9046bda..cc6c094d 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -585,14 +585,12 @@ void noinline *get_addr(u_int vaddr) //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) @@ -7218,8 +7216,12 @@ int new_recompile_block(u_int addr) 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 */ @@ -7234,7 +7236,7 @@ int new_recompile_block(u_int addr) /* 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]); @@ -7724,7 +7726,7 @@ int new_recompile_block(u_int addr) assert(start+i*4 8 || dops[i].opcode == 0x11)) { done=stop_after_jal=1; SysPrintf("Disabled speculative precompilation\n"); }