Skip to content

Commit

Permalink
s390x/tcg: MVCLU: Fault-safe handling
Browse files Browse the repository at this point in the history
The last remaining bit is padding with two bytes.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
  • Loading branch information
davidhildenbrand committed Sep 23, 2019
1 parent b7809f3 commit b8e7b2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions target/s390x/mem_helper.c
Expand Up @@ -925,15 +925,17 @@ static inline uint32_t do_mvcl(CPUS390XState *env,
access_memset(env, &desta, pad, ra);
*dest = wrap_address(env, *dest + len);
} else {
desta = access_prepare(env, *dest, len, MMU_DATA_STORE, mmu_idx, ra);

/* The remaining length selects the padding byte. */
for (i = 0; i < len; (*destlen)--, i++) {
if (*destlen & 1) {
cpu_stb_data_ra(env, *dest, pad, ra);
access_set_byte(env, &desta, i, pad, ra);
} else {
cpu_stb_data_ra(env, *dest, pad >> 8, ra);
access_set_byte(env, &desta, i, pad >> 8, ra);
}
*dest = wrap_address(env, *dest + 1);
}
*dest = wrap_address(env, *dest + len);
}

return *destlen ? 3 : cc;
Expand Down

0 comments on commit b8e7b2f

Please sign in to comment.