Fix Thumb-1 BE32 execution and disassembly.

Thumb-1 code has some issues in BE32 mode (as currently implemented). In
short, since bytes are swapped within words at load time for BE32
executables, this also swaps pairs of adjacent Thumb-1 instructions.

This patch un-swaps those pairs of instructions again, both for execution,
and for disassembly. (The previous version of the patch always read four
bytes in arm_read_memory_func and then extracted the proper two bytes,
in a probably misguided attempt to match the behaviour of actual hardware
as described by e.g. the ARM9TDMI TRM, section 3.3 "Endian effects for
instruction fetches". It's less complicated to just read the correct
two bytes though.)

Signed-off-by: Julian Brown <julian@codesourcery.com>
Message-id: ca20462a044848000370318a8bd41dd0a4ed273f.1484929304.git.julian@codesourcery.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 files changed
tree: f533aa39ca2f33bb53b6135f93f2072069ad9fae
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. chardev/
  6. contrib/
  7. crypto/
  8. default-configs/
  9. disas/
  10. docs/
  11. fpu/
  12. fsdev/
  13. gdb-xml/
  14. hw/
  15. include/
  16. io/
  17. libdecnumber/
  18. linux-headers/
  19. linux-user/
  20. migration/
  21. nbd/
  22. net/
  23. pc-bios/
  24. po/
  25. qapi/
  26. qga/
  27. qobject/
  28. qom/
  29. replay/
  30. roms/
  31. scripts/
  32. slirp/
  33. stubs/
  34. target/
  35. tcg/
  36. tests/
  37. trace/
  38. ui/
  39. util/
  40. .dir-locals.el
  41. .exrc
  42. .gitignore
  43. .gitmodules
  44. .mailmap
  45. .travis.yml
  46. accel.c
  47. aio-posix.c
  48. aio-win32.c
  49. arch_init.c
  50. async.c
  51. atomic_template.h
  52. balloon.c
  53. block.c
  54. blockdev-nbd.c
  55. blockdev.c
  56. blockjob.c
  57. bootdevice.c
  58. bt-host.c
  59. bt-vhci.c
  60. Changelog
  61. CODING_STYLE
  62. configure
  63. COPYING
  64. COPYING.LIB
  65. cpu-exec-common.c
  66. cpu-exec.c
  67. cpus-common.c
  68. cpus.c
  69. cputlb.c
  70. device-hotplug.c
  71. device_tree.c
  72. disas.c
  73. dma-helpers.c
  74. dump.c
  75. exec.c
  76. gdbstub.c
  77. HACKING
  78. hax-stub.c
  79. hmp-commands-info.hx
  80. hmp-commands.hx
  81. hmp.c
  82. hmp.h
  83. iohandler.c
  84. ioport.c
  85. iothread.c
  86. kvm-all.c
  87. kvm-stub.c
  88. LICENSE
  89. main-loop.c
  90. MAINTAINERS
  91. Makefile
  92. Makefile.objs
  93. Makefile.target
  94. memory.c
  95. memory_ldst.inc.c
  96. memory_mapping.c
  97. module-common.c
  98. monitor.c
  99. numa.c
  100. os-posix.c
  101. os-win32.c
  102. page_cache.c
  103. qapi-schema.json
  104. qdev-monitor.c
  105. qdict-test-data.txt
  106. qemu-bridge-helper.c
  107. qemu-doc.texi
  108. qemu-ga.texi
  109. qemu-img-cmds.hx
  110. qemu-img.c
  111. qemu-img.texi
  112. qemu-io-cmds.c
  113. qemu-io.c
  114. qemu-nbd.c
  115. qemu-nbd.texi
  116. qemu-option-trace.texi
  117. qemu-options-wrapper.h
  118. qemu-options.h
  119. qemu-options.hx
  120. qemu-seccomp.c
  121. qemu-tech.texi
  122. qemu-timer.c
  123. qemu.nsi
  124. qemu.sasl
  125. qmp.c
  126. qtest.c
  127. README
  128. replication.c
  129. replication.h
  130. rules.mak
  131. softmmu_template.h
  132. spice-qemu-char.c
  133. tcg-runtime.c
  134. tci.c
  135. thread-pool.c
  136. thunk.c
  137. tpm.c
  138. trace-events
  139. translate-all.c
  140. translate-all.h
  141. translate-common.c
  142. user-exec-stub.c
  143. user-exec.c
  144. VERSION
  145. version.rc
  146. vl.c
  147. xen-common-stub.c
  148. xen-common.c
  149. xen-hvm-stub.c
  150. xen-hvm.c
  151. xen-mapcache.c