unicorn/qemu/target/arm
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
..
arm_ldst.h Fix Thumb-1 BE32 execution and disassembly. 2018-03-02 00:20:11 -05:00
arm-powerctl.c ARM: Factor out ARM on/off PSCI control functions 2018-03-01 23:31:47 -05:00
arm-powerctl.h ARM: Factor out ARM on/off PSCI control functions 2018-03-01 23:31:47 -05:00
cpu64.c target/arm: Make 'any' CPU just an alias for 'max' 2018-03-12 10:11:49 -04:00
cpu-qom.h target/arm: Add "-cpu max" support 2018-03-12 10:11:49 -04:00
cpu.c cpu: Add Error argument to cpu_exec_init() 2018-03-21 07:50:33 -04:00
cpu.h cpu: get rid of unused cpu_init() defines 2018-03-20 14:21:45 -04:00
crypto_helper.c target/arm/cpu and crypto_helper: Correct bad merge and adjust to qemu code style 2018-03-12 11:57:24 -04:00
helper-a64.c target/arm/helper64: Correct bad merge 2018-03-12 11:37:27 -04:00
helper-a64.h arm/translate-a64: add FP16 FSQRT to simd_two_reg_misc_fp16 2018-03-08 21:57:35 -05:00
helper.c target/arm: Report unsupported MPU region sizes more clearly 2018-04-11 19:32:16 -04:00
helper.h target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK 2018-03-25 16:33:04 -04:00
internals.h target/arm: Factor out code to calculate FSR for debug exceptions 2018-03-25 16:35:27 -04:00
iwmmxt_helper.c Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
kvm-consts.h arm: better stub version for MISMATCH_CHECK 2018-03-02 00:13:45 -05:00
Makefile.objs target/arm: Decode aa64 armv8.1 scalar three same extra 2018-03-09 00:02:23 -05:00
neon_helper.c target/*/cpu.h: remove softfloat.h 2018-03-08 09:58:47 -05:00
op_addsub.h Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
op_helper.c icount: fix cpu_restore_state_from_tb for non-tb-exit cases 2018-04-11 20:05:40 -04:00
psci.c fix WFI/WFE length in syndrome register 2018-03-05 11:21:51 -05:00
translate-a64.c target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK 2018-03-25 16:33:04 -04:00
translate.c target-arm: Check undefined opcodes for SWP in A32 decoder 2018-04-11 19:30:50 -04:00
translate.h tcg: Introduce tcg_set_insn_start_param 2018-04-11 19:34:18 -04:00
unicorn_aarch64.c unicorn/aarch64: Use qemu-provided helpers for accessing VFP/NEON/SIMD registers 2018-03-07 11:25:41 -05:00
unicorn_arm.c Use DEFINE_MACHINE() to register all machines 2018-03-11 15:12:46 -04:00
unicorn.h Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
vec_helper.c translate/arm/vec_helper: Align to qemu formatting 2018-03-12 11:59:14 -04:00