replay: check icount in cpu exec loop
PATCH 1/1 replay: check icount in cpu exec loop
This patch adds check to break cpu loop when icount expires without setting the TB_EXIT_ICOUNT_EXPIRED flag. It happens when there is no available translated blocks and all instructions were executed. In icount replay mode unnecessary tb_find will be called (which may cause an exception) and execution will be non-deterministic.
This patch should be applied over Paolo's series:
https://www.mail-archive.com/[email protected]/msg426058.html
Signed-off-by Pavel Dovgalyuk <[email protected]>
--- cpu-exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
cpu-exec.c +2 -1
@@ -519,7 +519,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, }/* Finally, check if we need to exit to the main loop. */ -if (unlikely (atomic_read (&cpu->exit_request) ||replay_has_interrupt ())) { +if (unlikely (atomic_read (&cpu->exit_request) + || (use_icount && cpu->icount_decr.u16.low + cpu->icount_extra ==0 ))) {atomic_set (&cpu->exit_request,0 ); cpu->exception_index =EXCP_INTERRUPT ;return true;
Signature · 1 line
2.8.1