revision 591:7b9612fd2395
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 591:7b9612fd2395 |
parent | 590:4db6a084ca3c |
child | 592:4343cbfdd21b |
author | nkeynes |
date | Thu Jan 17 10:11:37 2008 +0000 (16 years ago) |
Add flag to skip breakpoints when it's the very first instruction of a run
(ie, so executing dreamcast_run() when the current pc is a breakpoint doesn't
just return immediately)
(ie, so executing dreamcast_run() when the current pc is a breakpoint doesn't
just return immediately)
src/sh4/sh4.c | view | annotate | diff | log | ||
src/sh4/sh4core.h | view | annotate | diff | log | ||
src/sh4/sh4trans.c | view | annotate | diff | log | ||
src/sh4/sh4trans.h | view | annotate | diff | log | ||
src/sh4/sh4x86.c | view | annotate | diff | log | ||
src/sh4/sh4x86.in | view | annotate | diff | log |
1.1 --- a/src/sh4/sh4.c Wed Jan 16 09:39:16 2008 +00001.2 +++ b/src/sh4/sh4.c Thu Jan 17 10:11:37 2008 +00001.3 @@ -42,13 +42,14 @@1.4 uint32_t sh4_xlat_run_slice( uint32_t );1.6 struct dreamcast_module sh4_module = { "SH4", sh4_init, sh4_reset,1.7 - NULL, sh4_run_slice, sh4_stop,1.8 + sh4_start, sh4_run_slice, sh4_stop,1.9 sh4_save_state, sh4_load_state };1.11 struct sh4_registers sh4r;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 +gboolean sh4_starting = FALSE;1.16 static gboolean sh4_use_translator = FALSE;1.17 struct sh4_icache_struct sh4_icache = { NULL, -1, -1, 0 };1.19 @@ -80,6 +81,11 @@1.20 sh4_reset();1.21 }1.23 +void sh4_start(void)1.24 +{1.25 + sh4_starting = TRUE;1.26 +}1.27 +1.28 void sh4_reset(void)1.29 {1.30 if( sh4_use_translator ) {
2.1 --- a/src/sh4/sh4core.h Wed Jan 16 09:39:16 2008 +00002.2 +++ b/src/sh4/sh4core.h Thu Jan 17 10:11:37 2008 +00002.3 @@ -34,6 +34,7 @@2.4 extern struct breakpoint_struct sh4_breakpoints[MAX_BREAKPOINTS];2.5 extern int sh4_breakpoint_count;2.6 extern sh4ptr_t sh4_main_ram;2.7 +extern gboolean sh4_starting;2.9 /**2.10 * Cached direct pointer to the current instruction page. If AT is on, this
3.1 --- a/src/sh4/sh4trans.c Wed Jan 16 09:39:16 2008 +00003.2 +++ b/src/sh4/sh4trans.c Thu Jan 17 10:11:37 2008 +00003.3 @@ -36,7 +36,6 @@3.5 /**3.6 * Execute a timeslice using translated code only (ie translate/execute loop)3.7 - * Note this version does not support breakpoints3.8 */3.9 uint32_t sh4_xlat_run_slice( uint32_t nanosecs )3.10 {3.11 @@ -95,6 +94,7 @@3.12 }3.14 xlat_running = FALSE;3.15 + sh4_starting = FALSE;3.17 if( sh4r.sh4_state != SH4_STATE_STANDBY ) {3.18 TMU_run_slice( nanosecs );3.19 @@ -222,6 +222,14 @@3.20 longjmp(xlat_jmp_buf, exit_code);3.21 }3.23 +void sh4_translate_breakpoint_hit(uint32_t pc)3.24 +{3.25 + if( sh4_starting && sh4r.slice_cycle == 0 && pc == sh4r.pc ) {3.26 + return;3.27 + }3.28 + sh4_translate_exit( XLAT_EXIT_BREAKPOINT );3.29 +}3.30 +3.31 /**3.32 * Exit the current block at the end of the current instruction, flush the3.33 * translation cache (completely) and return control to sh4_xlat_run_slice.
4.1 --- a/src/sh4/sh4trans.h Wed Jan 16 09:39:16 2008 +00004.2 +++ b/src/sh4/sh4trans.h Thu Jan 17 10:11:37 2008 +00004.3 @@ -112,3 +112,10 @@4.4 * the specified exit code (one of the XLAT_EXIT_* values).4.5 */4.6 void sh4_translate_exit( int exit_code );4.7 +4.8 +/**4.9 + * Support function called from the translator when a breakpoint is hit.4.10 + * Either returns immediately (to skip the breakpoint), or aborts the current4.11 + * cycle and never returns.4.12 + */4.13 +void sh4_translate_breakpoint_hit( sh4vma_t pc );
5.1 --- a/src/sh4/sh4x86.c Wed Jan 16 09:39:16 2008 +00005.2 +++ b/src/sh4/sh4x86.c Thu Jan 17 10:11:37 2008 +00005.3 @@ -364,8 +364,8 @@5.4 */5.5 void sh4_translate_emit_breakpoint( sh4vma_t pc )5.6 {5.7 - load_imm32( R_EAX, XLAT_EXIT_BREAKPOINT );5.8 - call_func1( sh4_translate_exit, R_EAX );5.9 + load_imm32( R_EAX, pc );5.10 + call_func1( sh4_translate_breakpoint_hit, R_EAX );5.11 }5.13 /**
6.1 --- a/src/sh4/sh4x86.in Wed Jan 16 09:39:16 2008 +00006.2 +++ b/src/sh4/sh4x86.in Thu Jan 17 10:11:37 2008 +00006.3 @@ -364,8 +364,8 @@6.4 */6.5 void sh4_translate_emit_breakpoint( sh4vma_t pc )6.6 {6.7 - load_imm32( R_EAX, XLAT_EXIT_BREAKPOINT );6.8 - call_func1( sh4_translate_exit, R_EAX );6.9 + load_imm32( R_EAX, pc );6.10 + call_func1( sh4_translate_breakpoint_hit, R_EAX );6.11 }6.13 /**
.