s390x/tcg: MVCLU: Fault-safe handling
authorDavid Hildenbrand <david@redhat.com>
Thu, 5 Sep 2019 12:56:07 +0000 (14:56 +0200)
committerDavid Hildenbrand <david@redhat.com>
Mon, 23 Sep 2019 07:28:29 +0000 (09:28 +0200)
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>
target/s390x/mem_helper.c

index aed53a37daed141632d23f5bf8e3f65dac1fec5c..271b1db664efc7617cf1bcc7cd2a9ab45fb86e9f 100644 (file)
@@ -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;