unicorn/qemu/include
Pavel Dovgalyuk b4bf3c776b
icount: fix cpu_restore_state_from_tb for non-tb-exit cases
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.

Backports commit afd46fcad2dceffda35c0586f5723c127b6e09d8 from qemu
2018-04-11 20:05:40 -04:00
..
crypto
exec icount: fix cpu_restore_state_from_tb for non-tb-exit cases 2018-04-11 20:05:40 -04:00
fpu configure: Drop ancient Solaris 9 and earlier support 2018-03-09 12:14:21 -05:00
hw Use cpu_create(type) instead of cpu_init(cpu_model) 2018-03-20 14:20:30 -04:00
qapi qobject: introduce qobject_get_try_str() 2018-03-20 11:10:03 -04:00
qemu compiler: Add QEMU_BUILD_BUG_MSG() macro 2018-03-20 10:43:37 -04:00
qom cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
sysemu
config.h
elf.h include/elf: Update elf.h to commit f71a8eaffba3271cf7cdad95572f6996f7523a5b 2018-03-11 15:34:35 -04:00
glib_compat.h Use cpu_create(type) instead of cpu_init(cpu_model) 2018-03-20 14:20:30 -04:00
qemu-common.h