Search
lxdream.org :: lxdream :: r925:7cbcc51db63d
lxdream 0.9.1
released Jun 29
Download Now
changeset925:7cbcc51db63d
parent924:195577c0445c
child926:68f3e0fe02f1
authornkeynes
dateSun Dec 14 06:36:49 2008 +0000 (10 years ago)
Fix 64-bit disassembly
src/test/testsh4x86.c
src/x86dasm/x86dasm.c
src/x86dasm/x86dasm.h
1.1 --- a/src/test/testsh4x86.c Thu Dec 11 23:29:12 2008 +0000
1.2 +++ b/src/test/testsh4x86.c Sun Dec 14 06:36:49 2008 +0000
1.3 @@ -189,15 +189,15 @@
1.4 sh4_icache.page_ppa = start_addr & 0xFFFFF000;
1.5
1.6 xlat_cache_init();
1.7 - uint32_t pc;
1.8 + uintptr_t pc;
1.9 uint8_t *buf = sh4_translate_basic_block( start_addr );
1.10 uint32_t buflen = xlat_get_code_size(buf);
1.11 - x86_disasm_init( buf, 0x8c010000, buflen );
1.12 + x86_disasm_init( buf, buf, buflen );
1.13 x86_set_symtab( local_symbols, sizeof(local_symbols)/sizeof(struct x86_symbol) );
1.14 - for( pc = 0x8c010000; pc < 0x8c010000 + buflen; ) {
1.15 + for( pc = buf; pc < buf + buflen; ) {
1.16 char buf[256];
1.17 char op[256];
1.18 - uint32_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );
1.19 + uintptr_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );
1.20 fprintf( stdout, "%s\n", buf );
1.21 pc = pc2;
1.22 }
2.1 --- a/src/x86dasm/x86dasm.c Thu Dec 11 23:29:12 2008 +0000
2.2 +++ b/src/x86dasm/x86dasm.c Sun Dec 14 06:36:49 2008 +0000
2.3 @@ -51,12 +51,12 @@
2.4 void x86_disasm_block(FILE *out, void *start, uint32_t len)
2.5 {
2.6 uintptr_t start_addr = (uintptr_t)start;
2.7 - uint32_t pc;
2.8 + uintptr_t pc;
2.9 x86_disasm_init( start, start_addr, len );
2.10 for( pc = start_addr; pc < start_addr + len; ) {
2.11 char buf[256];
2.12 char op[256];
2.13 - uint32_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );
2.14 + uintptr_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );
2.15 fprintf( out, "%08X: %-20s %s\n", pc, op, buf );
2.16 pc = pc2;
2.17 }
2.18 @@ -66,7 +66,7 @@
2.19 {
2.20 init_disassemble_info( &x86_disasm_info, NULL, x86_disasm_output );
2.21 x86_disasm_info.arch = bfd_arch_i386;
2.22 -#if SH4_TRANSLATOR == TARGET_X86_64
2.23 +#if SIZEOF_VOID_P == 8
2.24 x86_disasm_info.mach = bfd_mach_x86_64_intel_syntax;
2.25 #else
2.26 x86_disasm_info.mach = bfd_mach_i386_i386_intel_syntax;
2.27 @@ -116,7 +116,7 @@
2.28 }
2.29 }
2.30
2.31 -uint32_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode )
2.32 +uintptr_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode )
2.33 {
2.34 int count, i;
2.35
3.1 --- a/src/x86dasm/x86dasm.h Thu Dec 11 23:29:12 2008 +0000
3.2 +++ b/src/x86dasm/x86dasm.h Sun Dec 14 06:36:49 2008 +0000
3.3 @@ -30,4 +30,4 @@
3.4 void x86_disasm_block( FILE *out, void *block, uint32_t len );
3.5 void x86_set_symtab( x86_symbol *symtab, int num_symbols );
3.6 void x86_disasm_init(unsigned char *buf, uintptr_t vma, int buflen);
3.7 -uint32_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
3.8 +uintptr_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
.