Skip to content

Commit

Permalink
target-s390x: fix CC computation for EX instruction
Browse files Browse the repository at this point in the history
Commit 7a6c706 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.

Signed-off-by: Aurelien Jarno <[email protected]>
[agraf: remove set_cc_static in op_ex as suggested by rth]
Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
aurel32 authored and agraf committed Jun 4, 2015
1 parent 3b730f5 commit ee0d0be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions target-s390x/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2101,13 +2101,12 @@ 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);
tcg_temp_free_i64(tmp);

set_cc_static(s);
return NO_EXIT;
}

Expand Down

0 comments on commit ee0d0be

Please sign in to comment.