cpu-exec: avoid cpu_exec_nocache infinite loop with record/replay
commit17b50b0c299f1266578b01f7134810362418ac2e
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Tue, 14 Nov 2017 08:18:18 +0000 (14 11:18 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Nov 2017 13:46:46 +0000 (14 14:46 +0100)
treee758e9c1eb9aa5e65f3a4636589a96d09f6eaf6f
parente01cecabf3e04d22340d7e8b3616ef051c42c891
cpu-exec: avoid cpu_exec_nocache infinite loop with record/replay

This patch ensures that icount_decr.u32.high is clear before calling
cpu_exec_nocache when exception is pending.  Because the exception is
caused by the first instruction in the block and it cannot be executed
without resetting the flag.

There are two parts in the fix.  First, clear icount_decr.u32.high in
cpu_handle_interrupt (just before processing the "dependent" request,
stored in cpu->interrupt_request or cpu->exit_request) rather than
cpu_loop_exec_tb; this ensures that cpu_handle_exception is always
reached with zero icount_decr.u32.high unless another interrupt has
happened in the meanwhile.

Second, try to cause the exception at the beginning of
cpu_handle_exception, and exit immediately if the TB cannot
execute.  With this change, interrupts are processed and
cpu_exec_nocache can make process.

Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20171114081818.27640.33165.stgit@pasha-VirtualBox>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/tcg/cpu-exec.c