]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
cpu-exec: wrap tcg_qemu_tb_exec() in a fn to restore the PC
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 9 May 2013 15:30:29 +0000 (19:30 +0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 14 May 2013 20:48:14 +0000 (15:48 -0500)
commit69001b31458560ca7cf18151cad279714fd443c1
tree0466521ea63779e4852c7d4dab041ab11a492d4b
parent3accab7365f75b9017182ffdc1af50f30eb3be5d
cpu-exec: wrap tcg_qemu_tb_exec() in a fn to restore the PC

If tcg_qemu_tb_exec() returns a value whose low bits don't indicate a
link to an indexed next TB, this means that the TB execution never
started (eg because the instruction counter hit zero).  In this case the
guest PC has to be reset to the address of the start of the TB.
Refactor the cpu-exec code to make all tcg_qemu_tb_exec() calls pass
through a wrapper function which does this restoration if necessary.

Note that the apparent change in cpu_exec_nocache() from calling
cpu_pc_from_tb() with the old TB to calling it with the TB returned by
do_tcg_qemu_tb_exec() is safe, because in the nocache case we can
guarantee that the TB we try to execute is not linked to any others,
so the only possible returned TB is the one we started at. That is,
we should arguably previously have included in cpu_exec_nocache() an
assert(next_tb & ~TB_EXIT_MASK) == tb), since the API requires restore
from next_tb but we were using tb.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 77211379d73ea0c89c0b5bb6eee74b17cb06f9a8)

Conflicts:
cpu-exec.c

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
cpu-exec.c