aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-27 20:15:00 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-27 20:15:00 +0000
commitc2d551ff5acc0e236fe7fd8dfb1ce290d9ff4d99 (patch)
tree786eee7bdf52ced6206c27ce4345aa5069108c7e
parent192c7bd92722d0d4a55cc9ed59b642e0aaf0d5c8 (diff)
ARM thumb disassembly (Paul Brook)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1416 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--arm-dis.c5
-rw-r--r--disas.c21
2 files changed, 23 insertions, 3 deletions
diff --git a/arm-dis.c b/arm-dis.c
index a84d91b488..1e027efc70 100644
--- a/arm-dis.c
+++ b/arm-dis.c
@@ -1556,6 +1556,11 @@ print_insn_arm (pc, info)
}
is_thumb = force_thumb;
+ if (pc & 1)
+ {
+ is_thumb = 1;
+ pc &= ~(bfd_vma) 1;
+ }
#if 0
if (!is_thumb && info->symbols != NULL)
diff --git a/disas.c b/disas.c
index 8754713a81..ded2c6d72c 100644
--- 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,7 +149,10 @@ 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;
#elif defined(TARGET_PPC)