diff options
author | Lara Lazier <laramglazier@gmail.com> | 2021-07-21 17:26:50 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-07-22 14:44:47 +0200 |
commit | 213ff024a2f92020290296cb9dc29c2af3d4a221 (patch) | |
tree | 69b2dc0ab6ec8a12f6dd93bf8baa7ea2fa8f2fb5 /target/i386/tcg/sysemu/misc_helper.c | |
parent | b128b25a5a2b1a7db6965a6d3fd0e4f6f0affc50 (diff) |
target/i386: Added consistency checks for CR4
All MBZ bits in CR4 must be zero. (APM2 15.5)
Added reserved bitmask and added checks in both
helper_vmrun and helper_write_crN.
Signed-off-by: Lara Lazier <laramglazier@gmail.com>
Message-Id: <20210721152651.14683-2-laramglazier@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/tcg/sysemu/misc_helper.c')
-rw-r--r-- | target/i386/tcg/sysemu/misc_helper.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/target/i386/tcg/sysemu/misc_helper.c b/target/i386/tcg/sysemu/misc_helper.c index db0d8a9d79..a2af2c9bba 100644 --- a/target/i386/tcg/sysemu/misc_helper.c +++ b/target/i386/tcg/sysemu/misc_helper.c @@ -99,6 +99,9 @@ void helper_write_crN(CPUX86State *env, int reg, target_ulong t0) cpu_x86_update_cr3(env, t0); break; case 4: + if (t0 & cr4_reserved_bits(env)) { + cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); + } if (((t0 ^ env->cr[4]) & CR4_LA57_MASK) && (env->hflags & HF_CS64_MASK)) { raise_exception_ra(env, EXCP0D_GPF, GETPC()); |