]> git.proxmox.com Git - mirror_qemu.git/commitdiff
s390x/tcg: Fix max_byte detection for stfle
authorDavid Hildenbrand <david@redhat.com>
Fri, 31 May 2019 14:31:44 +0000 (16:31 +0200)
committerDavid Hildenbrand <david@redhat.com>
Fri, 7 Jun 2019 12:53:25 +0000 (14:53 +0200)
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>
target/s390x/misc_helper.c

index ee67c1fa0c510fde263d3dd1ad96c3104c2d0d21..34476134a4070127cc63e7229c37796eab9eee57 100644 (file)
@@ -669,7 +669,7 @@ 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) {
@@ -677,6 +677,7 @@ uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t addr)
     }
 
     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);
     }