aboutsummaryrefslogtreecommitdiff
path: root/qom/cpu.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-10-10 10:48:50 -0400
committerRichard Henderson <richard.henderson@linaro.org>2018-10-18 18:58:10 -0700
commitfff42f183ea4c3967405d4c1dce6d97dae4d64c8 (patch)
tree5d68af55ddf42c9025133a17c0a21e318a47aaae /qom/cpu.c
parentd7f425fdea991f052241c6479acd9feae834063b (diff)
tcg: access cpu->icount_decr.u16.high with atomics
Consistently access u16.high with atomics to avoid undefined behaviour in MTTCG. Note that icount_decr.u16.low is only used in icount mode, so regular accesses to it are OK. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Message-Id: <20181010144853.13005-2-cota@braap.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'qom/cpu.c')
-rw-r--r--qom/cpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index f7746546d0..9ad1372d57 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -265,7 +265,7 @@ static void cpu_common_reset(CPUState *cpu)
cpu->mem_io_pc = 0;
cpu->mem_io_vaddr = 0;
cpu->icount_extra = 0;
- cpu->icount_decr.u32 = 0;
+ atomic_set(&cpu->icount_decr.u32, 0);
cpu->can_do_io = 1;
cpu->exception_index = -1;
cpu->crash_occurred = false;