]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target/i386: fail if toggling LA57 in 64-bit mode
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 Mar 2021 13:42:32 +0000 (09:42 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Mar 2021 12:48:18 +0000 (08:48 -0400)
This fixes kvm-unit-tests access.flat with -cpu qemu64,la57.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/tcg/misc_helper.c

index 90b87fdef00395adda8472d1016f7795274a4d9b..a25428c36e51b6f2d5339b19e6ab56edf20fed50 100644 (file)
@@ -167,6 +167,10 @@ void helper_write_crN(CPUX86State *env, int reg, target_ulong t0)
         cpu_x86_update_cr3(env, t0);
         break;
     case 4:
+        if (((t0 ^ env->cr[4]) & CR4_LA57_MASK) &&
+            (env->hflags & HF_CS64_MASK)) {
+             raise_exception_ra(env, EXCP0D_GPF, GETPC());
+        }
         cpu_x86_update_cr4(env, t0);
         break;
     case 8: