mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
softmmu: fix watchpoint processing in icount mode
Watchpoint processing code restores vCPU state twice: in tb_check_watchpoint and in cpu_loop_exit_restore/cpu_restore_state. Normally it does not affect anything, but in icount mode instruction counter is incremented twice and becomes incorrect. This patch eliminates unneeded CPU state restore. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <163542168516.2127597.8781375223437124644.stgit@pasha-ThinkPad-X280> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
93a967fbb5
commit
9f660c077b
|
@ -938,18 +938,16 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
||||||
cpu->watchpoint_hit = wp;
|
cpu->watchpoint_hit = wp;
|
||||||
|
|
||||||
mmap_lock();
|
mmap_lock();
|
||||||
|
/* This call also restores vCPU state */
|
||||||
tb_check_watchpoint(cpu, ra);
|
tb_check_watchpoint(cpu, ra);
|
||||||
if (wp->flags & BP_STOP_BEFORE_ACCESS) {
|
if (wp->flags & BP_STOP_BEFORE_ACCESS) {
|
||||||
cpu->exception_index = EXCP_DEBUG;
|
cpu->exception_index = EXCP_DEBUG;
|
||||||
mmap_unlock();
|
mmap_unlock();
|
||||||
cpu_loop_exit_restore(cpu, ra);
|
cpu_loop_exit(cpu);
|
||||||
} else {
|
} else {
|
||||||
/* Force execution of one insn next time. */
|
/* Force execution of one insn next time. */
|
||||||
cpu->cflags_next_tb = 1 | curr_cflags(cpu);
|
cpu->cflags_next_tb = 1 | curr_cflags(cpu);
|
||||||
mmap_unlock();
|
mmap_unlock();
|
||||||
if (ra) {
|
|
||||||
cpu_restore_state(cpu, ra, true);
|
|
||||||
}
|
|
||||||
cpu_loop_exit_noexc(cpu);
|
cpu_loop_exit_noexc(cpu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue