Search
lxdream.org :: lxdream/src/x86dasm/x86dasm.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/x86dasm/x86dasm.c
changeset 527:14c9489f647e
prev515:5e5bb1dd369e
next561:533f6b478071
next586:2a3ba82cf243
author nkeynes
date Sun Nov 18 11:12:44 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change x86-64 translator work-in-progress
file annotate diff log raw
1.1 --- a/src/x86dasm/x86dasm.c Thu Nov 15 08:17:17 2007 +0000
1.2 +++ b/src/x86dasm/x86dasm.c Sun Nov 18 11:12:44 2007 +0000
1.3 @@ -23,6 +23,7 @@
1.4 #include "bfd.h"
1.5 #include "dis-asm.h"
1.6 #include "sh4/sh4core.h"
1.7 +#include "sh4/sh4trans.h"
1.8
1.9 extern const struct reg_desc_struct sh4_reg_map[];
1.10 const struct cpu_desc_struct x86_cpu_desc =
1.11 @@ -49,7 +50,7 @@
1.12
1.13 void x86_disasm_block(FILE *out, void *start, uint32_t len)
1.14 {
1.15 - uint32_t start_addr = (uint32_t)start;
1.16 + uintptr_t start_addr = (uintptr_t)start;
1.17 uint32_t pc;
1.18 x86_disasm_init( start, start_addr, len );
1.19 for( pc = start_addr; pc < start_addr + len; ) {
1.20 @@ -61,11 +62,15 @@
1.21 }
1.22 }
1.23
1.24 -void x86_disasm_init(unsigned char *buf, uint32_t vma, int buflen)
1.25 +void x86_disasm_init(unsigned char *buf, uintptr_t vma, int buflen)
1.26 {
1.27 init_disassemble_info( &x86_disasm_info, NULL, x86_disasm_output );
1.28 x86_disasm_info.arch = bfd_arch_i386;
1.29 +#if SH4_TRANSLATOR == TARGET_X86_64
1.30 + x86_disasm_info.mach = bfd_mach_x86_64_intel_syntax;
1.31 +#else
1.32 x86_disasm_info.mach = bfd_mach_i386_i386_intel_syntax;
1.33 +#endif
1.34 x86_disasm_info.endian = BFD_ENDIAN_LITTLE;
1.35 x86_disasm_info.buffer = buf;
1.36 x86_disasm_info.buffer_vma = vma;
1.37 @@ -83,7 +88,7 @@
1.38 {
1.39 int i;
1.40 for( i=0; i<x86_num_symbols; i++ ) {
1.41 - if( x86_symtab[i].ptr == (void *)(uint32_t)memaddr ) {
1.42 + if( x86_symtab[i].ptr == (void *)(uintptr_t)memaddr ) {
1.43 return x86_symtab[i].name;
1.44 }
1.45 }
1.46 @@ -99,7 +104,7 @@
1.47 }
1.48 }
1.49
1.50 -uint32_t x86_disasm_instruction( uint32_t pc, char *buf, int len, char *opcode )
1.51 +uint32_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode )
1.52 {
1.53 int count, i;
1.54
.