diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2013-02-22 18:10:02 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2013-03-03 14:28:37 +0000 |
commit | 77211379d73ea0c89c0b5bb6eee74b17cb06f9a8 (patch) | |
tree | fefbdb43a06725304a1d8854bdd5ca1abca81bd6 /translate-all.c | |
parent | fadf982584b040527aeee0ede270a4d01463d293 (diff) |
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>
Diffstat (limited to 'translate-all.c')
0 files changed, 0 insertions, 0 deletions