aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2011-03-01 19:07:27 +0200
committernotaz2011-03-01 19:10:51 +0200
commitdc990066a301c231e5982a346f4809b4e0247a51 (patch)
treee4c9b0dbfe47400ed398c87a8208373d1048d1c2
parent4f5a1b2a86d077d32086de91f487a2ee5270714d (diff)
downloadpcsx_rearmed-dc990066a301c231e5982a346f4809b4e0247a51.tar.gz
pcsx_rearmed-dc990066a301c231e5982a346f4809b4e0247a51.tar.bz2
pcsx_rearmed-dc990066a301c231e5982a346f4809b4e0247a51.zip
drc: clear dynarec completely on CD image change
most likely only BIOS can be reused anyway, no need to stress invalidation code needlessly (even if it does it all well).
-rw-r--r--frontend/menu.c3
-rw-r--r--libpcsxcore/new_dynarec/new_dynarec.c46
-rw-r--r--libpcsxcore/new_dynarec/new_dynarec.h1
3 files changed, 33 insertions, 17 deletions
diff --git a/frontend/menu.c b/frontend/menu.c
index a7aa8b2..87b8788 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -25,6 +25,7 @@
#include "../libpcsxcore/misc.h"
#include "../libpcsxcore/cdrom.h"
#include "../libpcsxcore/psemu_plugin_defs.h"
+#include "../libpcsxcore/new_dynarec/new_dynarec.h"
#include "../plugins/dfinput/pad.h"
#include "revision.h"
@@ -1349,6 +1350,8 @@ static int romsel_run(void)
printf("selected file: %s\n", fname);
+ new_dynarec_clear_full();
+
if (run_cd_image(fname) != 0)
return -1;
diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c
index 1f33c75..72af92d 100644
--- a/libpcsxcore/new_dynarec/new_dynarec.c
+++ b/libpcsxcore/new_dynarec/new_dynarec.c
@@ -7709,20 +7709,10 @@ void disassemble_inst(int i)
}
}
-void new_dynarec_init()
+// clear the state completely, instead of just marking
+// things invalid like invalidate_all_pages() does
+void new_dynarec_clear_full()
{
- printf("Init new dynarec\n");
- out=(u_char *)BASE_ADDR;
- if (mmap (out, 1<<TARGET_SIZE_2,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
- -1, 0) <= 0) {printf("mmap() failed\n");}
-#ifdef MUPEN64
- rdword=&readmem_dword;
- fake_pc.f.r.rs=&readmem_dword;
- fake_pc.f.r.rt=&readmem_dword;
- fake_pc.f.r.rd=&readmem_dword;
-#endif
int n;
for(n=0x80000;n<0x80800;n++)
invalid_code[n]=1;
@@ -7730,14 +7720,11 @@ void new_dynarec_init()
hash_table[n][0]=hash_table[n][2]=-1;
memset(mini_ht,-1,sizeof(mini_ht));
memset(restore_candidate,0,sizeof(restore_candidate));
+ memset(shadow,0,sizeof(shadow));
copy=shadow;
expirep=16384; // Expiry pointer, +2 blocks
pending_exception=0;
literalcount=0;
-#ifdef HOST_IMM8
- // Copy this into local area so we don't have to put it in every literal pool
- invc_ptr=invalid_code;
-#endif
stop_after_jal=0;
// TLB
using_tlb=0;
@@ -7747,6 +7734,31 @@ void new_dynarec_init()
memory_map[n]=((u_int)rdram-0x80000000)>>2;
for(n=526336;n<1048576;n++) // 0x80800000 .. 0xFFFFFFFF
memory_map[n]=-1;
+ for(n=0;n<4096;n++) ll_clear(jump_in+n);
+ for(n=0;n<4096;n++) ll_clear(jump_out+n);
+ for(n=0;n<4096;n++) ll_clear(jump_dirty+n);
+}
+
+void new_dynarec_init()
+{
+ printf("Init new dynarec\n");
+ out=(u_char *)BASE_ADDR;
+ if (mmap (out, 1<<TARGET_SIZE_2,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
+ -1, 0) <= 0) {printf("mmap() failed\n");}
+#ifdef MUPEN64
+ rdword=&readmem_dword;
+ fake_pc.f.r.rs=&readmem_dword;
+ fake_pc.f.r.rt=&readmem_dword;
+ fake_pc.f.r.rd=&readmem_dword;
+#endif
+ int n;
+ new_dynarec_clear_full();
+#ifdef HOST_IMM8
+ // Copy this into local area so we don't have to put it in every literal pool
+ invc_ptr=invalid_code;
+#endif
#ifdef MUPEN64
for(n=0;n<0x8000;n++) { // 0 .. 0x7FFFFFFF
writemem[n] = write_nomem_new;
diff --git a/libpcsxcore/new_dynarec/new_dynarec.h b/libpcsxcore/new_dynarec/new_dynarec.h
index 580977b..14319da 100644
--- a/libpcsxcore/new_dynarec/new_dynarec.h
+++ b/libpcsxcore/new_dynarec/new_dynarec.h
@@ -6,6 +6,7 @@ extern int stop;
void new_dynarec_init();
void new_dynarec_cleanup();
+void new_dynarec_clear_full();
void new_dyna_start();
void invalidate_all_pages();