Search
lxdream.org :: lxdream/src/sh4/sh4trans.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4trans.c
changeset 1091:186558374345
prev1067:d3c00ffccfcd
next1094:d2324eb67223
author nkeynes
date Tue Dec 15 08:46:37 2009 +1000 (10 years ago)
permissions -rw-r--r--
last change Add side-by-side x86+sh4 disassembly output
Print SH4 state information and disassembly of the current block when
crashing.
Fix delay slot instruction in conditional branch not being marked as a
delay-slot instruction in the branch-not-taken path.
Rename REG_* defines in cpu.h to avoid conflict with translation defs
file annotate diff log raw
1.1 --- a/src/sh4/sh4trans.c Sun Jul 05 13:54:48 2009 +1000
1.2 +++ b/src/sh4/sh4trans.c Tue Dec 15 08:46:37 2009 +1000
1.3 @@ -240,3 +240,37 @@
1.4 return result;
1.5 }
1.6
1.7 +/**
1.8 + * Crashdump translation information.
1.9 + *
1.10 + * Print out the currently executing block (if any), in source and target
1.11 + * assembly.
1.12 + *
1.13 + * Note: we want to be _really_ careful not to cause a second-level crash
1.14 + * at this point (e.g. if the lookup tables are corrupted...)
1.15 + */
1.16 +void sh4_translate_crashdump()
1.17 +{
1.18 + if( !IS_IN_ICACHE(sh4r.pc) ) {
1.19 + /** If we're crashing due to an icache lookup failure, we'll probably
1.20 + * hit this case - just complain and return.
1.21 + */
1.22 + fprintf( stderr, "** SH4 PC not in current instruction region **\n" );
1.23 + return;
1.24 + }
1.25 + uint32_t pma = GET_ICACHE_PHYS(sh4r.pc);
1.26 + void *code = xlat_get_code( pma );
1.27 + if( code == NULL ) {
1.28 + fprintf( stderr, "** No translated block for current SH4 PC **\n" );
1.29 + return;
1.30 + }
1.31 +
1.32 + /* Sanity check on the code pointer */
1.33 + if( !xlat_is_code_pointer(code) ) {
1.34 + fprintf( stderr, "** Possibly corrupt translation cache **\n" );
1.35 + return;
1.36 + }
1.37 +
1.38 + void *native_pc = xlat_get_native_pc( code, xlat_get_code_size(code) );
1.39 + sh4_translate_disasm_block( stderr, code, sh4r.pc, native_pc );
1.40 +}
.