On 25/01/2017 12:50, Pavel Dovgalyuk wrote:
>>> + /* icount has expired, we need to break the execution loop.
>>> + This check is needed before tb_find to make execution
>>> + deterministic - tb_find may cause an exception
>>> + while translating the code from non-mapped page. */
>>> + if (use_icount && ((cpu->icount_extra == 0
>>> + && cpu->icount_decr.u16.low == 0)
>>> + || (int32_t)cpu->icount_decr.u32 < 0)) {
>>> + if (cpu->exception_index == -1) {
>>> + cpu->exception_index = EXCP_INTERRUPT;
>>> + }
>>> + cpu_loop_exit(cpu);
>>> + }
>> Can this can be placed in cpu_handle_interrupt itself?
> I guess it could. I placed it here because it doesn't related to interrupts.
True, on the other hand neither is
if (unlikely(atomic_read(&cpu->exit_request) || replay_has_interrupt())) {
atomic_set(&cpu->exit_request, 0);
cpu->exception_index = EXCP_INTERRUPT;
cpu_loop_exit(cpu);
}
Except for the replay_has_interrupt() that you added, but I don't understand
that one either...
Paolo