filename | src/sh4/sh4.c |
changeset | 1171:d644413208a3 |
prev | 1125:9dd5dee45db9 |
next | 1182:b38a327ad8fa |
author | Nathan Keynes <nkeynes@lxdream.org> |
date | Tue May 10 20:31:14 2011 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Fix SLEEP issue on timeslice border - Don't update slice_cycle if we're already past it in sh4_sleep_run_slice - Make sure we don't re-enter the main run_slice if we're sleeping |
file | annotate | diff | log | raw |
1.1 --- a/src/sh4/sh4.c Mon Sep 13 10:13:42 2010 +10001.2 +++ b/src/sh4/sh4.c Tue May 10 20:31:14 2011 +10001.3 @@ -246,10 +246,6 @@1.4 {1.5 sh4r.slice_cycle = 0;1.7 - if( sh4r.sh4_state != SH4_STATE_RUNNING ) {1.8 - sh4_sleep_run_slice(nanosecs);1.9 - }1.10 -1.11 /* Setup for sudden vm exits */1.12 switch( setjmp(sh4_exit_jmp_buf) ) {1.13 case CORE_EXIT_BREAKPOINT:1.14 @@ -267,25 +263,28 @@1.15 dreamcast_reset();1.16 break;1.17 case CORE_EXIT_SLEEP:1.18 - sh4_sleep_run_slice(nanosecs);1.19 break;1.20 case CORE_EXIT_FLUSH_ICACHE:1.21 xlat_flush_cache();1.22 break;1.23 }1.25 - sh4_running = TRUE;1.26 -1.27 - /* Execute the core's real slice */1.28 + if( sh4r.sh4_state != SH4_STATE_RUNNING ) {1.29 + sh4_sleep_run_slice(nanosecs);1.30 + } else {1.31 + sh4_running = TRUE;1.32 +1.33 + /* Execute the core's real slice */1.34 #ifdef SH4_TRANSLATOR1.35 - if( sh4_use_translator ) {1.36 - sh4_translate_run_slice(nanosecs);1.37 - } else {1.38 + if( sh4_use_translator ) {1.39 + sh4_translate_run_slice(nanosecs);1.40 + } else {1.41 + sh4_emulate_run_slice(nanosecs);1.42 + }1.43 +#else1.44 sh4_emulate_run_slice(nanosecs);1.45 +#endif1.46 }1.47 -#else1.48 - sh4_emulate_run_slice(nanosecs);1.49 -#endif1.51 /* And finish off the peripherals afterwards */1.53 @@ -621,8 +620,7 @@1.54 */1.55 uint32_t sh4_sleep_run_slice( uint32_t nanosecs )1.56 {1.57 - int sleep_state = sh4r.sh4_state;1.58 - assert( sleep_state != SH4_STATE_RUNNING );1.59 + assert( sh4r.sh4_state != SH4_STATE_RUNNING );1.61 while( sh4r.event_pending < nanosecs ) {1.62 sh4r.slice_cycle = sh4r.event_pending;1.63 @@ -634,7 +632,8 @@1.64 return sh4r.slice_cycle;1.65 }1.66 }1.67 - sh4r.slice_cycle = nanosecs;1.68 + if( sh4r.slice_cycle < nanosecs )1.69 + sh4r.slice_cycle = nanosecs;1.70 return sh4r.slice_cycle;1.71 }
.