Commit c2d551ff5acc0e236fe7fd8dfb1ce290d9ff4d99

Authored by bellard
1 parent 192c7bd9

ARM thumb disassembly (Paul Brook)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1416 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 23 additions and 3 deletions
arm-dis.c
... ... @@ -1556,6 +1556,11 @@ print_insn_arm (pc, info)
1556 1556 }
1557 1557  
1558 1558 is_thumb = force_thumb;
  1559 + if (pc & 1)
  1560 + {
  1561 + is_thumb = 1;
  1562 + pc &= ~(bfd_vma) 1;
  1563 + }
1559 1564  
1560 1565 #if 0
1561 1566 if (!is_thumb && info->symbols != NULL)
... ...
... ... @@ -108,8 +108,20 @@ bfd_vma bfd_getb32 (const bfd_byte *addr)
108 108 return (bfd_vma) v;
109 109 }
110 110  
111   -/* Disassemble this for me please... (debugging). 'flags' is only used
112   - for i386: non zero means 16 bit code */
  111 +#ifdef TARGET_ARM
  112 +static int
  113 +print_insn_thumb1(bfd_vma pc, disassemble_info *info)
  114 +{
  115 + return print_insn_arm(pc | 1, info);
  116 +}
  117 +#endif
  118 +
  119 +/* Disassemble this for me please... (debugging). 'flags' has teh following
  120 + values:
  121 + i386 - nonzero means 16 bit code
  122 + arm - nonzero means thumb code
  123 + other targets - unused
  124 + */
113 125 void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
114 126 {
115 127 target_ulong pc;
... ... @@ -137,7 +149,10 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
137 149 disasm_info.mach = bfd_mach_i386_i386;
138 150 print_insn = print_insn_i386;
139 151 #elif defined(TARGET_ARM)
140   - print_insn = print_insn_arm;
  152 + if (flags)
  153 + print_insn = print_insn_thumb1;
  154 + else
  155 + print_insn = print_insn_arm;
141 156 #elif defined(TARGET_SPARC)
142 157 print_insn = print_insn_sparc;
143 158 #elif defined(TARGET_PPC)
... ...