On 22/01/2015 09:52, Pavel Dovgalyuk wrote:
> + if (replay_mode == REPLAY_MODE_RECORD) {
> + replay_save_instructions();
> + replay_put_event(EVENT_EXCEPTION);
> + return true;
Missing mutex lock/unlock.
> + } else if (replay_mode == REPLAY_MODE_PLAY) {
> + bool res = false;
> + replay_exec_instructions();
> + replay_mutex_lock();
> + if (skip_async_events(EVENT_EXCEPTION)) {
> + replay_has_unread_data = 0;
> + res = true;
> + }
> + replay_mutex_unlock();
> + return res;
> + }
bool res;
replay_exec_instructions();
res = replay_has_exception();
if (res) {
replay_has_unread_data = 0;
}
return res;
Same for replay_interrupt().
Perhaps worth factoring out two functions replay_cpu_event and
replay_has_cpu_event? You choose.
>
> @@ -1294,6 +1295,9 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int
> interrupt_request)
> if (interrupt_request & CPU_INTERRUPT_POLL) {
> cs->interrupt_request &= ~CPU_INTERRUPT_POLL;
> apic_poll_irq(cpu->apic_state);
> + if (replay_mode != REPLAY_MODE_NONE) {
> + return true;
> + }
> }
> #endif
Can you explain this? It probably needs a comment.
Paolo