target-arm: Fix and improve AA32 singlestep translation completion code

The AArch32 translation completion code for singlestep enabled/active
case was a way more confusing and too repetitive then it needs to be.
Probably that was the cause for a bug to be introduced into it at some
point. The bug was that SWI/HVC/SMC exception would be generated in
condition-failed instruction code path whereas it shouldn't.

This patch rewrites the code in a way similar to the non-singlestep
case.

In the condition-passed/unconditional instruction code path we need to:
 - Write the condexec bits back to the CPU state
 - Advance the singlestep state machine and generate a corresponding
   exception in case of SWI/HVC/SMC
 - Write the PC back to the CPU state if it hasn't already been written
   and generate an appropriate singlestep exception otherwise

In the condition-failed instruction code path we need to:
 - Set a TCG label to jump to it if the condition is failed
 - Write the condexec bits back to the CPU state
 - Write the PC back to the CPU state since it hasn't been written in
   this case
 - Generate an appropriate singlestep exception

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