filename | src/sh4/sh4trans.c |
changeset | 740:dd11269ee48b |
prev | 736:a02d1475ccfd |
next | 809:8bdbf4d95da4 |
author | nkeynes |
date | Wed Jul 30 22:50:44 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Bug #61: OpenBSD support (Modified) patch from bsdmaniak, thanks! |
file | annotate | diff | log | raw |
1.1 --- a/src/sh4/sh4trans.c Mon Jul 14 07:44:42 2008 +00001.2 +++ b/src/sh4/sh4trans.c Wed Jul 30 22:50:44 2008 +00001.3 @@ -17,7 +17,6 @@1.4 * GNU General Public License for more details.1.5 */1.6 #include <assert.h>1.7 -#include <setjmp.h>1.8 #include "eventq.h"1.9 #include "syscall.h"1.10 #include "clock.h"1.11 @@ -27,45 +26,11 @@1.12 #include "sh4/xltcache.h"1.15 -static jmp_buf xlat_jmp_buf;1.16 -static gboolean xlat_running = FALSE;1.17 -1.18 -gboolean sh4_xlat_is_running()1.19 -{1.20 - return xlat_running;1.21 -}1.22 -1.23 /**1.24 * Execute a timeslice using translated code only (ie translate/execute loop)1.25 */1.26 -uint32_t sh4_xlat_run_slice( uint32_t nanosecs )1.27 +uint32_t sh4_translate_run_slice( uint32_t nanosecs )1.28 {1.29 - sh4r.slice_cycle = 0;1.30 -1.31 - if( sh4r.sh4_state != SH4_STATE_RUNNING ) {1.32 - sh4_sleep_run_slice(nanosecs);1.33 - }1.34 -1.35 - switch( setjmp(xlat_jmp_buf) ) {1.36 - case XLAT_EXIT_BREAKPOINT:1.37 - sh4_clear_breakpoint( sh4r.pc, BREAK_ONESHOT );1.38 - /* fallthrough */1.39 - case XLAT_EXIT_HALT:1.40 - if( sh4r.sh4_state != SH4_STATE_STANDBY ) {1.41 - TMU_run_slice( sh4r.slice_cycle );1.42 - SCIF_run_slice( sh4r.slice_cycle );1.43 - dreamcast_stop();1.44 - return sh4r.slice_cycle;1.45 - }1.46 - case XLAT_EXIT_SYSRESET:1.47 - dreamcast_reset();1.48 - break;1.49 - case XLAT_EXIT_SLEEP:1.50 - sh4_sleep_run_slice(nanosecs);1.51 - break;1.52 - }1.53 -1.54 - xlat_running = TRUE;1.55 void * (*code)() = NULL;1.56 while( sh4r.slice_cycle < nanosecs ) {1.57 if( sh4r.event_pending <= sh4r.slice_cycle ) {1.58 @@ -93,14 +58,6 @@1.59 }1.60 code = code();1.61 }1.62 -1.63 - xlat_running = FALSE;1.64 - sh4_starting = FALSE;1.65 - sh4r.slice_cycle = nanosecs;1.66 - if( sh4r.sh4_state != SH4_STATE_STANDBY ) {1.67 - TMU_run_slice( nanosecs );1.68 - SCIF_run_slice( nanosecs );1.69 - }1.70 return nanosecs;1.71 }1.73 @@ -197,26 +154,7 @@1.74 sh4r.pc += (recovery->sh4_icount<<1);1.75 }1.77 -void sh4_translate_unwind_stack( gboolean abort_after, unwind_thunk_t thunk )1.78 -{1.79 - void *pc = xlat_get_native_pc();1.80 -1.81 - assert( pc != NULL );1.82 - void *code = xlat_get_code( sh4r.pc );1.83 - xlat_recovery_record_t recover = xlat_get_recovery(code, pc, TRUE);1.84 - if( recover != NULL ) {1.85 - // Can be null if there is no recovery necessary1.86 - sh4_translate_run_recovery(recover);1.87 - }1.88 - if( thunk != NULL ) {1.89 - thunk();1.90 - }1.91 - // finally longjmp back into sh4_xlat_run_slice1.92 - xlat_running = FALSE;1.93 - longjmp(xlat_jmp_buf, XLAT_EXIT_CONTINUE);1.94 -}1.95 -1.96 -void sh4_translate_exit( int exit_code )1.97 +void sh4_translate_exit_recover( )1.98 {1.99 void *pc = xlat_get_native_pc();1.100 if( pc != NULL ) {1.101 @@ -228,9 +166,6 @@1.102 sh4_translate_run_recovery(recover);1.103 }1.104 }1.105 - // finally longjmp back into sh4_xlat_run_slice1.106 - xlat_running = FALSE;1.107 - longjmp(xlat_jmp_buf, exit_code);1.108 }1.110 void sh4_translate_breakpoint_hit(uint32_t pc)1.111 @@ -238,7 +173,7 @@1.112 if( sh4_starting && sh4r.slice_cycle == 0 && pc == sh4r.pc ) {1.113 return;1.114 }1.115 - sh4_translate_exit( XLAT_EXIT_BREAKPOINT );1.116 + sh4_core_exit( CORE_EXIT_BREAKPOINT );1.117 }1.119 /**1.120 @@ -252,7 +187,7 @@1.121 *1.122 * Must only be invoked (indirectly) from within translated code.1.123 */1.124 -void sh4_translate_flush_cache()1.125 +gboolean sh4_translate_flush_cache()1.126 {1.127 void *pc = xlat_get_native_pc();1.128 assert( pc != NULL );1.129 @@ -263,11 +198,10 @@1.130 // Can be null if there is no recovery necessary1.131 sh4_translate_run_recovery(recover);1.132 xlat_flush_cache();1.133 - xlat_running = FALSE;1.134 - longjmp(xlat_jmp_buf, XLAT_EXIT_CONTINUE);1.135 + return TRUE;1.136 } else {1.137 xlat_flush_cache();1.138 - return;1.139 + return FALSE;1.140 }1.141 }1.143 @@ -289,7 +223,7 @@1.144 if( !mmu_update_icache(sh4r.pc) ) {1.145 // double fault - halt1.146 ERROR( "Double fault - halting" );1.147 - dreamcast_stop();1.148 + sh4_core_exit(CORE_EXIT_HALT);1.149 return NULL;1.150 }1.151 }
.