1.1 --- a/src/sh4/sh4.c Wed Oct 29 23:51:58 2008 +0000
1.2 +++ b/src/sh4/sh4.c Sat Dec 20 03:01:40 2008 +0000
1.4 void sh4_stop( void );
1.5 void sh4_save_state( FILE *f );
1.6 int sh4_load_state( FILE *f );
1.7 +static void sh4_reset_pointer_cache();
1.9 uint32_t sh4_run_slice( uint32_t );
1.10 uint32_t sh4_xlat_run_slice( uint32_t );
1.12 struct breakpoint_struct sh4_breakpoints[MAX_BREAKPOINTS];
1.13 int sh4_breakpoint_count = 0;
1.14 sh4ptr_t sh4_main_ram;
1.15 +sh4ptr_t dc_boot_rom;
1.16 +sh4ptr_t dc_flash_ram;
1.17 +sh4ptr_t dc_audio_ram;
1.19 gboolean sh4_starting = FALSE;
1.20 static gboolean sh4_use_translator = FALSE;
1.21 static jmp_buf sh4_exit_jmp_buf;
1.24 register_io_regions( mmio_list_sh4mmio );
1.25 sh4_main_ram = mem_get_region_by_name(MEM_REGION_MAIN);
1.26 + dc_boot_rom = mem_get_region_by_name(MEM_REGION_BIOS);
1.27 + dc_flash_ram = mem_get_region_by_name(MEM_REGION_FLASH);
1.28 + dc_audio_ram = mem_get_region_by_name(MEM_REGION_AUDIO);
1.34 /* zero everything out, for the sake of having a consistent state. */
1.35 memset( &sh4r, 0, sizeof(sh4r) );
1.36 + sh4_reset_pointer_cache();
1.38 /* Resume running if we were halted */
1.39 sh4r.sh4_state = SH4_STATE_RUNNING;
1.41 sh4r.in_delay_slot = FALSE;
1.44 - fwrite( &sh4r, sizeof(sh4r), 1, f );
1.45 + int len = ((char *)&sh4r.pointer_cache) - ((char *)&sh4r);
1.46 + fwrite( &sh4r, len, 1, f );
1.47 MMU_save_state( f );
1.48 PMM_save_state( f );
1.49 INTC_save_state( f );
1.51 if( sh4_use_translator ) {
1.54 - fread( &sh4r, sizeof(sh4r), 1, f );
1.55 + int len = ((char *)&sh4r.pointer_cache) - ((char *)&sh4r);
1.56 + fread( &sh4r, len, 1, f );
1.57 + sh4_reset_pointer_cache();
1.58 MMU_load_state( f );
1.59 PMM_load_state( f );
1.60 INTC_load_state( f );
1.61 @@ -255,6 +267,16 @@
1.62 return SCIF_load_state( f );
1.65 +static void sh4_reset_pointer_cache()
1.68 + for( i=0; i<16; i++ ) {
1.69 + sh4r.pointer_cache[i].page_vma = -1;
1.70 + sh4r.pointer_cache[i].page_mask = 0xFFFFF000;
1.72 + sh4r.pointer_cache[16].page_vma = -1;
1.73 + sh4r.pointer_cache[16].page_mask = 0xFFFFF000;
1.76 void sh4_set_breakpoint( uint32_t pc, breakpoint_type_t type )