Commit 95cbfc643dd8e0c4dd3690fbbbbc20f2a8af5998

Authored by bellard
1 parent 5898e816

changed disas() prototype for multi target support


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@233 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 18 additions and 13 deletions
... ... @@ -92,8 +92,9 @@ bfd_vma bfd_getb32 (const bfd_byte *addr)
92 92 return (bfd_vma) v;
93 93 }
94 94  
95   -/* Disassemble this for me please... (debugging). */
96   -void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
  95 +/* Disassemble this for me please... (debugging). 'flags' is only used
  96 + for i386: non zero means 16 bit code */
  97 +void disas(FILE *out, void *code, unsigned long size, int is_host, int flags)
97 98 {
98 99 uint8_t *pc;
99 100 int count;
... ... @@ -106,7 +107,7 @@ void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
106 107 disasm_info.buffer_vma = (unsigned long)code;
107 108 disasm_info.buffer_length = size;
108 109  
109   - if (type == DISAS_TARGET) {
  110 + if (is_host) {
110 111 #ifdef WORDS_BIGENDIAN
111 112 disasm_info.endian = BFD_ENDIAN_BIG;
112 113 #else
... ... @@ -128,13 +129,23 @@ void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
128 129 return;
129 130 #endif
130 131 } else {
131   - /* Currently only source supported in x86. */
  132 +#ifdef TARGET_WORDS_BIGENDIAN
  133 + disasm_info.endian = BFD_ENDIAN_BIG;
  134 +#else
132 135 disasm_info.endian = BFD_ENDIAN_LITTLE;
133   - if (type == DISAS_I386_I386)
  136 +#endif
  137 +#if defined(TARGET_I386)
  138 + if (!flags)
134 139 disasm_info.mach = bfd_mach_i386_i386;
135 140 else
136 141 disasm_info.mach = bfd_mach_i386_i8086;
137 142 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
138 149 }
139 150  
140 151 for (pc = code; pc < (uint8_t *)code + size; pc += count) {
... ... @@ -142,7 +153,7 @@ void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
142 153 #ifdef __arm__
143 154 /* since data are included in the code, it is better to
144 155 display code data too */
145   - if (type == DISAS_TARGET) {
  156 + if (is_host) {
146 157 fprintf(out, "%08x ", (int)bfd_getl32((const bfd_byte *)pc));
147 158 }
148 159 #endif
... ...
1 1 #ifndef _QEMU_DISAS_H
2 2 #define _QEMU_DISAS_H
3 3  
4   -enum disas_type {
5   - DISAS_I386_I386,
6   - DISAS_I386_I8086,
7   - DISAS_TARGET, /* whatever host is. */
8   -};
9   -
10 4 /* Disassemble this for me please... (debugging). */
11   -void disas(FILE *out, void *code, unsigned long size, enum disas_type type);
  5 +void disas(FILE *out, void *code, unsigned long size, int is_host, int flags);
12 6  
13 7 /* Look up symbol for debugging purpose. Returns "" if unknown. */
14 8 const char *lookup_symbol(void *orig_addr);
... ...