mirror_qemu/target/arm
Pavel Dovgalyuk afd46fcad2 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.

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>
2018-04-11 09:05:22 +10:00
..
Makefile.objs target/arm: Decode aa64 armv8.1 scalar three same extra 2018-03-02 11:03:45 +00:00
arch_dump.c target/arm: Add aa{32, 64}_vfp_{dreg, qreg} helpers 2018-01-25 11:45:29 +00:00
arm-powerctl.c target-arm/powerctl: defer cpu reset work to CPU context 2017-02-24 10:32:46 +00:00
arm-powerctl.h target-arm/powerctl: defer cpu reset work to CPU context 2017-02-24 10:32:46 +00:00
arm-semi.c
arm_ldst.h Fix Thumb-1 BE32 execution and disassembly. 2017-02-07 18:29:59 +00:00
cpu-qom.h target/arm: Add "-cpu max" support 2018-03-09 17:09:44 +00:00
cpu.c target/arm: Make 'any' CPU just an alias for 'max' 2018-03-09 17:09:44 +00:00
cpu.h cpu: get rid of unused cpu_init() defines 2018-03-19 14:10:36 -03:00
cpu64.c target/arm: Make 'any' CPU just an alias for 'max' 2018-03-09 17:09:44 +00:00
crypto_helper.c target/arm: implement SM4 instructions 2018-02-09 10:40:28 +00:00
gdbstub.c
gdbstub64.c
helper-a64.c arm/translate-a64: add FP16 FSQRT to simd_two_reg_misc_fp16 2018-03-01 11:13:59 +00:00
helper-a64.h arm/translate-a64: add FP16 FSQRT to simd_two_reg_misc_fp16 2018-03-01 11:13:59 +00:00
helper.c target/arm: Report unsupported MPU region sizes more clearly 2018-04-10 13:02:25 +01:00
helper.h target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK 2018-03-23 18:26:46 +00:00
idau.h target/arm: Define an IDAU interface 2018-03-02 11:03:45 +00:00
internals.h target/arm: Factor out code to calculate FSR for debug exceptions 2018-03-23 18:26:46 +00:00
iwmmxt_helper.c
kvm-consts.h arm: add trailing ; after MISMATCH_CHECK 2017-02-01 03:37:18 +02:00
kvm-stub.c
kvm.c target/arm: Move definition of 'host' cpu type into cpu.c 2018-03-09 17:09:44 +00:00
kvm32.c target/arm: Query host CPU features on-demand at instance init 2018-03-09 17:09:44 +00:00
kvm64.c target/arm: Query host CPU features on-demand at instance init 2018-03-09 17:09:44 +00:00
kvm_arm.h target/arm: Query host CPU features on-demand at instance init 2018-03-09 17:09:44 +00:00
machine.c target/arm: Implement v8M MSPLIM and PSPLIM registers 2018-02-15 18:29:49 +00:00
monitor.c qapi: Empty out qapi-schema.json 2018-03-02 13:45:50 -06:00
neon_helper.c target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
op_addsub.h
op_helper.c icount: fix cpu_restore_state_from_tb for non-tb-exit cases 2018-04-11 09:05:22 +10:00
psci.c fix WFI/WFE length in syndrome register 2017-10-31 11:50:50 +00:00
trace-events trace-events: fix code style: print 0x before hex numbers 2017-08-01 12:13:07 +01:00
translate-a64.c target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK 2018-03-23 18:26:46 +00:00
translate.c target-arm: Check undefined opcodes for SWP in A32 decoder 2018-04-10 13:02:24 +01:00
translate.h tcg: Introduce tcg_set_insn_start_param 2018-04-10 13:02:26 +01:00
vec_helper.c target/arm: Decode aa64 armv8.3 fcmla 2018-03-02 11:03:45 +00:00