On 05/17/2015 01:28 AM, Aurelien Jarno wrote:
Commit 7a6c7067f optimized CC computation by only saving cc_op before
calling helpers as they either don't touch the CC or generate a new
static value. This however doesn't work for the EX instruction as the
helper changes or not the CC value depending on the actual executed
instruction (e.g. MVC vs CLC).

This patches force a CC computation before calling the helper. This
fixes random memory corruption occuring in guests.

Cc: Richard Henderson <r...@twiddle.net>
Cc: Alexander Graf <ag...@suse.de>
Signed-off-by: Aurelien Jarno <aurel...@aurel32.net>

Sounds plausible to me, though I'm surprised I didn't run into this myself yet.

Richard?


Alex

---
  target-s390x/translate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index 80e3a54..10522df 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -2095,7 +2095,7 @@ static ExitStatus op_ex(DisasContext *s, DisasOps *o)
      TCGv_i64 tmp;
update_psw_addr(s);
-    update_cc_op(s);
+    gen_op_calc_cc(s);
tmp = tcg_const_i64(s->next_pc);
      gen_helper_ex(cc_op, cpu_env, cc_op, o->in1, o->in2, tmp);


Reply via email to