aboutsummaryrefslogtreecommitdiff
path: root/disas.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-15 19:44:10 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-15 19:44:10 +0000
commit95cbfc643dd8e0c4dd3690fbbbbc20f2a8af5998 (patch)
tree0feee9dab03e6696f0331a65759b0ab68c925f46 /disas.c
parent5898e816840dd7cb2492c4cce85525e7383f8def (diff)
changed disas() prototype for multi target support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@233 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'disas.c')
-rw-r--r--disas.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/disas.c b/disas.c
index 2a8a533b0f..dc1957b962 100644
--- a/disas.c
+++ b/disas.c
@@ -92,8 +92,9 @@ bfd_vma bfd_getb32 (const bfd_byte *addr)
return (bfd_vma) v;
}
-/* Disassemble this for me please... (debugging). */
-void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
+/* Disassemble this for me please... (debugging). 'flags' is only used
+ for i386: non zero means 16 bit code */
+void disas(FILE *out, void *code, unsigned long size, int is_host, int flags)
{
uint8_t *pc;
int count;
@@ -106,7 +107,7 @@ void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
disasm_info.buffer_vma = (unsigned long)code;
disasm_info.buffer_length = size;
- if (type == DISAS_TARGET) {
+ if (is_host) {
#ifdef WORDS_BIGENDIAN
disasm_info.endian = BFD_ENDIAN_BIG;
#else
@@ -128,13 +129,23 @@ void disas(FILE *out, void *code, unsigned long size, enum disas_type type)
return;
#endif
} else {
- /* Currently only source supported in x86. */
+#ifdef TARGET_WORDS_BIGENDIAN
+ disasm_info.endian = BFD_ENDIAN_BIG;
+#else
disasm_info.endian = BFD_ENDIAN_LITTLE;
- if (type == DISAS_I386_I386)
+#endif
+#if defined(TARGET_I386)
+ if (!flags)
disasm_info.mach = bfd_mach_i386_i386;
else
disasm_info.mach = bfd_mach_i386_i8086;
print_insn = print_insn_i386;
+#elif defined(TARGET_ARM)
+ print_insn = print_insn_arm;
+#else
+ fprintf(out, "Asm output not supported on this arch\n");
+ return;
+#endif
}
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)
#ifdef __arm__
/* since data are included in the code, it is better to
display code data too */
- if (type == DISAS_TARGET) {
+ if (is_host) {
fprintf(out, "%08x ", (int)bfd_getl32((const bfd_byte *)pc));
}
#endif