Search
lxdream.org :: lxdream/src/sh4/sh4trans.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4trans.c
changeset 1300:d18488c8668b
prev1298:d0eb2307b847
next1301:b76840ccf94b
author nkeynes
date Wed May 27 08:46:29 2015 +1000 (4 years ago)
permissions -rw-r--r--
last change Add support for extracting the ELF symbol table and printing symbol names
alongside the SH4 disassembly
file annotate diff log raw
1.1 --- a/src/sh4/sh4trans.c Wed Feb 04 08:38:23 2015 +1000
1.2 +++ b/src/sh4/sh4trans.c Wed May 27 08:46:29 2015 +1000
1.3 @@ -294,6 +294,16 @@
1.4 sh4_translate_disasm_block( stderr, code, sh4_pc, NULL );
1.5 }
1.6
1.7 +void sh4_translate_dump_block_phys( uint32_t sh4_pma )
1.8 +{
1.9 + void *code = xlat_get_code( sh4_pma );
1.10 + if( code == NULL ) {
1.11 + fprintf( stderr, "** No translated block for address %08x **\n", sh4_pma );
1.12 + return;
1.13 + }
1.14 + sh4_translate_disasm_block( stderr, code, sh4_pma, NULL );
1.15 +
1.16 +}
1.17
1.18 static struct xlat_symbol xlat_symbol_table[] = {
1.19 { "sh4r+128", ((char *)&sh4r)+128 },
1.20 @@ -338,6 +348,20 @@
1.21
1.22 for( target_pc = target_start; target_pc < target_end; ) {
1.23 uintptr_t pc2 = xlat_disasm_instruction( target_pc, buf, sizeof(buf), op );
1.24 +
1.25 + if( source_recov_table < source_recov_end &&
1.26 + target_pc >= (target_start + source_recov_table->xlat_offset) ) {
1.27 + source_recov_table++;
1.28 + if( source_end < (source_start + (source_recov_table->sh4_icount)*2) )
1.29 + source_end = source_start + (source_recov_table->sh4_icount)*2;
1.30 + }
1.31 +
1.32 + if( source_pc < source_end ) {
1.33 + const char *sym = sh4_disasm_get_symbol(source_pc);
1.34 + if( sym != 0 ) {
1.35 + fprintf( out, "%s:\n", sym );
1.36 + }
1.37 + }
1.38 #if SIZEOF_VOID_P == 8
1.39 fprintf( out, "%c%016lx: %-30s %-40s", (target_pc == (uintptr_t)native_pc ? '*' : ' '),
1.40 target_pc, op, buf );
1.41 @@ -345,12 +369,6 @@
1.42 fprintf( out, "%c%08lx: %-30s %-40s", (target_pc == (uintptr_t)native_pc ? '*' : ' '),
1.43 target_pc, op, buf );
1.44 #endif
1.45 - if( source_recov_table < source_recov_end &&
1.46 - target_pc >= (target_start + source_recov_table->xlat_offset) ) {
1.47 - source_recov_table++;
1.48 - if( source_end < (source_start + (source_recov_table->sh4_icount)*2) )
1.49 - source_end = source_start + (source_recov_table->sh4_icount)*2;
1.50 - }
1.51
1.52 if( source_pc < source_end ) {
1.53 uint32_t source_pc2 = sh4_disasm_instruction( source_pc, buf, sizeof(buf), op );
.