/[qemu]/qemu/disas.c
ViewVC logotype

Diff of /qemu/disas.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by bellard, Mon Jun 9 19:38:38 2003 UTC revision 1.6 by bellard, Sun Jun 15 19:44:10 2003 UTC
# Line 92  bfd_vma bfd_getb32 (const bfd_byte *addr Line 92  bfd_vma bfd_getb32 (const bfd_byte *addr
92    return (bfd_vma) v;    return (bfd_vma) v;
93  }  }
94    
95  /* Disassemble this for me please... (debugging). */  /* Disassemble this for me please... (debugging). 'flags' is only used
96  void disas(FILE *out, void *code, unsigned long size, enum disas_type type)     for i386: non zero means 16 bit code */
97    void disas(FILE *out, void *code, unsigned long size, int is_host, int flags)
98  {  {
99      uint8_t *pc;      uint8_t *pc;
100      int count;      int count;
# Line 106  void disas(FILE *out, void *code, unsign Line 107  void disas(FILE *out, void *code, unsign
107      disasm_info.buffer_vma = (unsigned long)code;      disasm_info.buffer_vma = (unsigned long)code;
108      disasm_info.buffer_length = size;      disasm_info.buffer_length = size;
109    
110      if (type == DISAS_TARGET) {      if (is_host) {
111  #ifdef WORDS_BIGENDIAN  #ifdef WORDS_BIGENDIAN
112          disasm_info.endian = BFD_ENDIAN_BIG;          disasm_info.endian = BFD_ENDIAN_BIG;
113  #else  #else
# Line 128  void disas(FILE *out, void *code, unsign Line 129  void disas(FILE *out, void *code, unsign
129          return;          return;
130  #endif  #endif
131      } else {      } else {
132          /* Currently only source supported in x86. */  #ifdef TARGET_WORDS_BIGENDIAN
133            disasm_info.endian = BFD_ENDIAN_BIG;
134    #else
135          disasm_info.endian = BFD_ENDIAN_LITTLE;          disasm_info.endian = BFD_ENDIAN_LITTLE;
136          if (type == DISAS_I386_I386)  #endif
137    #if defined(TARGET_I386)
138            if (!flags)
139              disasm_info.mach = bfd_mach_i386_i386;              disasm_info.mach = bfd_mach_i386_i386;
140          else          else
141              disasm_info.mach = bfd_mach_i386_i8086;              disasm_info.mach = bfd_mach_i386_i8086;
142          print_insn = print_insn_i386;          print_insn = print_insn_i386;
143    #elif defined(TARGET_ARM)
144            print_insn = print_insn_arm;
145    #else
146            fprintf(out, "Asm output not supported on this arch\n");
147            return;
148    #endif
149      }      }
150    
151      for (pc = code; pc < (uint8_t *)code + size; pc += count) {      for (pc = code; pc < (uint8_t *)code + size; pc += count) {
# Line 142  void disas(FILE *out, void *code, unsign Line 153  void disas(FILE *out, void *code, unsign
153  #ifdef __arm__  #ifdef __arm__
154          /* since data are included in the code, it is better to          /* since data are included in the code, it is better to
155             display code data too */             display code data too */
156          if (type == DISAS_TARGET) {          if (is_host) {
157              fprintf(out, "%08x  ", (int)bfd_getl32((const bfd_byte *)pc));              fprintf(out, "%08x  ", (int)bfd_getl32((const bfd_byte *)pc));
158          }          }
159  #endif  #endif

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26