aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-03-18 09:42:32 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2021-03-19 08:48:18 -0400
commitda3f3b020f5346f59c30241ff6f3da60be87ed78 (patch)
treee2529b165b16b28ee2bab9707e974a81717e9ff0 /target
parentb8184135835068e9579e678f0b54465ee6161d32 (diff)
downloadqemu-da3f3b020f5346f59c30241ff6f3da60be87ed78.zip
qemu-da3f3b020f5346f59c30241ff6f3da60be87ed78.tar.gz
qemu-da3f3b020f5346f59c30241ff6f3da60be87ed78.tar.bz2
target/i386: fail if toggling LA57 in 64-bit mode
This fixes kvm-unit-tests access.flat with -cpu qemu64,la57. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/i386/tcg/misc_helper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c
index 90b87fd..a25428c 100644
--- a/target/i386/tcg/misc_helper.c
+++ b/target/i386/tcg/misc_helper.c
@@ -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: