afd46fcad2
In icount mode, instructions that access io memory spaces in the middle of the translation block invoke TB recompilation. After recompilation, such instructions become last in the TB and are allowed to access io memory spaces. When the code includes instruction like i386 'xchg eax, 0xffffd080' which accesses APIC, QEMU goes into an infinite loop of the recompilation. This instruction includes two memory accesses - one read and one write. After the first access, APIC calls cpu_report_tpr_access, which restores the CPU state to get the current eip. But cpu_restore_state_from_tb resets the cpu->can_do_io flag which makes the second memory access invalid. Therefore the second memory access causes a recompilation of the block. Then these operations repeat again and again. This patch moves resetting cpu->can_do_io flag from cpu_restore_state_from_tb to cpu_loop_exit* functions. It also adds a parameter for cpu_restore_state which controls restoring icount. There is no need to restore icount when we only query CPU state without breaking the TB. Restoring it in such cases leads to the incorrect flow of the virtual time. In most cases new parameter is true (icount should be recalculated). But there are two cases in i386 and openrisc when the CPU state is only queried without the need to break the TB. This patch fixes both of these cases. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Message-Id: <20180409091320.12504.35329.stgit@pasha-VirtualBox> [rth: Make can_do_io setting unconditional; move from cpu_exec; make cpu_loop_exit_{noexc,restore} call cpu_loop_exit.] Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
||
---|---|---|
.. | ||
macio | ||
a9scu.c | ||
applesmc.c | ||
arm11scu.c | ||
arm_integrator_debug.c | ||
arm_l2x0.c | ||
arm_sysctl.c | ||
aspeed_scu.c | ||
aspeed_sdmc.c | ||
auxbus.c | ||
bcm2835_mbox.c | ||
bcm2835_property.c | ||
bcm2835_rng.c | ||
cbus.c | ||
debugexit.c | ||
eccmemctl.c | ||
edu.c | ||
exynos4210_clk.c | ||
exynos4210_pmu.c | ||
exynos4210_rng.c | ||
hyperv_testdev.c | ||
imx2_wdt.c | ||
imx6_ccm.c | ||
imx6_src.c | ||
imx7_ccm.c | ||
imx7_gpr.c | ||
imx7_snvs.c | ||
imx25_ccm.c | ||
imx31_ccm.c | ||
imx_ccm.c | ||
iotkit-secctl.c | ||
ivshmem.c | ||
Makefile.objs | ||
max111x.c | ||
milkymist-hpdmc.c | ||
milkymist-pfpu.c | ||
mips_cmgcr.c | ||
mips_cpc.c | ||
mips_itu.c | ||
mmio_interface.c | ||
mos6522.c | ||
mps2-fpgaio.c | ||
mps2-scc.c | ||
msf2-sysreg.c | ||
mst_fpga.c | ||
omap_clk.c | ||
omap_gpmc.c | ||
omap_l4.c | ||
omap_sdrc.c | ||
omap_tap.c | ||
pc-testdev.c | ||
pci-testdev.c | ||
puv3_pm.c | ||
pvpanic.c | ||
sga.c | ||
slavio_misc.c | ||
stm32f2xx_syscfg.c | ||
tmp105.c | ||
tmp105.h | ||
tmp421.c | ||
trace-events | ||
tz-ppc.c | ||
unimp.c | ||
vmcoreinfo.c | ||
zynq_slcr.c | ||
zynq-xadc.c |