Search
lxdream.org :: lxdream/src/sh4/sh4.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4.c
changeset 526:ba3da45b5754
prev502:c4ecae2b1b5e
next559:06714bc64271
next586:2a3ba82cf243
author nkeynes
date Sat Nov 17 06:04:19 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Don't build the translator if the architecture is unsupported. Also tidy things up a little to allow (theoretically) different translators to be selected at build time.
file annotate diff log raw
1.1 --- a/src/sh4/sh4.c Thu Nov 08 11:54:16 2007 +0000
1.2 +++ b/src/sh4/sh4.c Sat Nov 17 06:04:19 2007 +0000
1.3 @@ -35,7 +35,7 @@
1.4 #define EXV_INTERRUPT 0x600 /* External interrupt vector */
1.5
1.6 void sh4_init( void );
1.7 -void sh4_x86_init( void );
1.8 +void sh4_xlat_init( void );
1.9 void sh4_reset( void );
1.10 void sh4_start( void );
1.11 void sh4_stop( void );
1.12 @@ -53,9 +53,12 @@
1.13 struct breakpoint_struct sh4_breakpoints[MAX_BREAKPOINTS];
1.14 int sh4_breakpoint_count = 0;
1.15 extern sh4ptr_t sh4_main_ram;
1.16 +static gboolean sh4_use_translator = FALSE;
1.17
1.18 void sh4_set_use_xlat( gboolean use )
1.19 {
1.20 +// No-op if the translator was not built
1.21 +#ifdef SH4_TRANSLATOR
1.22 if( use ) {
1.23 xlat_cache_init();
1.24 sh4_x86_init();
1.25 @@ -63,6 +66,8 @@
1.26 } else {
1.27 sh4_module.run_time_slice = sh4_run_slice;
1.28 }
1.29 + sh4_use_translator = use;
1.30 +#endif
1.31 }
1.32
1.33 void sh4_init(void)
1.34 @@ -75,7 +80,7 @@
1.35
1.36 void sh4_reset(void)
1.37 {
1.38 - if( sh4_module.run_time_slice == sh4_xlat_run_slice ) {
1.39 + if( sh4_use_translator ) {
1.40 xlat_flush_cache();
1.41 }
1.42
1.43 @@ -106,7 +111,7 @@
1.44
1.45 void sh4_stop(void)
1.46 {
1.47 - if( sh4_module.run_time_slice == sh4_xlat_run_slice ) {
1.48 + if( sh4_use_translator ) {
1.49 /* If we were running with the translator, update new_pc and in_delay_slot */
1.50 sh4r.new_pc = sh4r.pc+2;
1.51 sh4r.in_delay_slot = FALSE;
1.52 @@ -116,7 +121,7 @@
1.53
1.54 void sh4_save_state( FILE *f )
1.55 {
1.56 - if( sh4_module.run_time_slice == sh4_xlat_run_slice ) {
1.57 + if( sh4_use_translator ) {
1.58 /* If we were running with the translator, update new_pc and in_delay_slot */
1.59 sh4r.new_pc = sh4r.pc+2;
1.60 sh4r.in_delay_slot = FALSE;
1.61 @@ -131,7 +136,7 @@
1.62
1.63 int sh4_load_state( FILE * f )
1.64 {
1.65 - if( sh4_module.run_time_slice == sh4_xlat_run_slice ) {
1.66 + if( sh4_use_translator ) {
1.67 xlat_flush_cache();
1.68 }
1.69 fread( &sh4r, sizeof(sh4r), 1, f );
.