Skip to content

Commit

Permalink
s390x/tcg: Fix max_byte detection for stfle
Browse files Browse the repository at this point in the history
used_stfl_bytes is 0, before initialized via prepare_stfl() on the
first invocation. We have to move the calculation of max_bytes after
prepare_stfl().

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
  • Loading branch information
davidhildenbrand committed Jun 7, 2019
1 parent 4f83d7d commit 88a29e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion target/s390x/misc_helper.c
Expand Up @@ -669,14 +669,15 @@ uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t addr)
{
const uintptr_t ra = GETPC();
const int count_bytes = ((env->regs[0] & 0xff) + 1) * 8;
const int max_bytes = ROUND_UP(used_stfl_bytes, 8);
int max_bytes;
int i;

if (addr & 0x7) {
s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra);
}

prepare_stfl();
max_bytes = ROUND_UP(used_stfl_bytes, 8);
for (i = 0; i < count_bytes; ++i) {
cpu_stb_data_ra(env, addr + i, stfl_bytes[i], ra);
}
Expand Down

0 comments on commit 88a29e8

Please sign in to comment.