]> git.proxmox.com Git - mirror_qemu.git/blobdiff - disas.c
sparc64 marge (Blue Swirl)
[mirror_qemu.git] / disas.c
diff --git a/disas.c b/disas.c
index 3a5549d2b685fb3bf61b84a37eba2ee7a5dd3798..c54e5d91c08ceb077b13288045b89a693ca75df6 100644 (file)
--- a/disas.c
+++ b/disas.c
@@ -108,8 +108,20 @@ bfd_vma bfd_getb32 (const bfd_byte *addr)
   return (bfd_vma) v;
 }
 
-/* Disassemble this for me please... (debugging). 'flags' is only used
-   for i386: non zero means 16 bit code */
+#ifdef TARGET_ARM
+static int
+print_insn_thumb1(bfd_vma pc, disassemble_info *info)
+{
+  return print_insn_arm(pc | 1, info);
+}
+#endif
+
+/* Disassemble this for me please... (debugging). 'flags' has teh following
+   values:
+    i386 - nonzero means 16 bit code
+    arm  - nonzero means thumb code 
+    other targets - unused
+ */
 void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
 {
     target_ulong pc;
@@ -137,22 +149,27 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
         disasm_info.mach = bfd_mach_i386_i386;
     print_insn = print_insn_i386;
 #elif defined(TARGET_ARM)
-    print_insn = print_insn_arm;
+    if (flags)
+       print_insn = print_insn_thumb1;
+    else
+       print_insn = print_insn_arm;
 #elif defined(TARGET_SPARC)
     print_insn = print_insn_sparc;
+#ifdef TARGET_SPARC64
+    disasm_info.mach = bfd_mach_sparc_v9b;
+#endif    
 #elif defined(TARGET_PPC)
+    if (cpu_single_env->msr[MSR_LE])
+        disasm_info.endian = BFD_ENDIAN_LITTLE;
     print_insn = print_insn_ppc;
 #else
-    fprintf(out, "Asm output not supported on this arch\n");
+    fprintf(out, "0x" TARGET_FMT_lx
+           ": Asm output not supported on this arch\n", code);
     return;
 #endif
 
     for (pc = code; pc < code + size; pc += count) {
-#if TARGET_LONG_BITS == 64        
-       fprintf(out, "0x%016llx:  ", pc);
-#else
-       fprintf(out, "0x%08x:  ", pc);
-#endif
+       fprintf(out, "0x" TARGET_FMT_lx ":  ", pc);
        count = print_insn(pc, &disasm_info);
 #if 0
         {
@@ -206,7 +223,8 @@ void disas(FILE *out, void *code, unsigned long size)
 #elif defined(__arm__) 
     print_insn = print_insn_arm;
 #else
-    fprintf(out, "Asm output not supported on this arch\n");
+    fprintf(out, "0x%lx: Asm output not supported on this arch\n",
+           (long) code);
     return;
 #endif
     for (pc = (unsigned long)code; pc < (unsigned long)code + size; pc += count) {
@@ -301,10 +319,12 @@ void monitor_disas(target_ulong pc, int nb_insn, int is_physical, int flags)
     disasm_info.endian = BFD_ENDIAN_LITTLE;
 #endif
 #if defined(TARGET_I386)
-    if (!flags)
-        disasm_info.mach = bfd_mach_i386_i386;
-    else
+    if (flags == 2)
+        disasm_info.mach = bfd_mach_x86_64;
+    else if (flags == 1) 
         disasm_info.mach = bfd_mach_i386_i8086;
+    else
+        disasm_info.mach = bfd_mach_i386_i386;
     print_insn = print_insn_i386;
 #elif defined(TARGET_ARM)
     print_insn = print_insn_arm;
@@ -313,12 +333,13 @@ void monitor_disas(target_ulong pc, int nb_insn, int is_physical, int flags)
 #elif defined(TARGET_PPC)
     print_insn = print_insn_ppc;
 #else
-    term_printf("Asm output not supported on this arch\n");
+    term_printf("0x" TARGET_FMT_lx
+               ": Asm output not supported on this arch\n", pc);
     return;
 #endif
 
     for(i = 0; i < nb_insn; i++) {
-       term_printf("0x%08lx:  ", (unsigned long)pc);
+       term_printf("0x" TARGET_FMT_lx ":  ", pc);
        count = print_insn(pc, &disasm_info);
        term_printf("\n");
        if (count < 0)