target-arm: Fix and improve AA32 singlestep translation completion code
commit7999a5c8f63344d91c0822a17dbf30e2489a1128
authorSergey Fedorov <serge.fdrv@gmail.com>
Thu, 17 Dec 2015 13:37:13 +0000 (17 13:37 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 17 Dec 2015 13:37:13 +0000 (17 13:37 +0000)
tree7738ff4496b494b952962ff3357bde15b49ea888
parent30901475b91ef1f46304404ab4bfe89097f61b96
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>
target-arm/translate.c