qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] target/i386: Added VMRUN consistency checks for CR3 and


From: Paolo Bonzini
Subject: Re: [PATCH 4/4] target/i386: Added VMRUN consistency checks for CR3 and CR4
Date: Tue, 6 Jul 2021 18:52:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 05/07/21 10:18, Lara Lazier wrote:
+#define CR4_RESERVED_MASK \
+(~(unsigned long)(CR4_VME_MASK | CR4_PVI_MASK | CR4_TSD_MASK \
+                | CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \
+                | CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \
+                | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \
+                | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \
+                | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK))
+

This ~ trick could also be useful for EFER, very nice!

Just a couple changes required:

1) CR4_PKS_MASK is missing here and in cr4_reserved_bits (TCG supports it but KVM does not)

2) the cast should be to target_ulong (to cover the case of 32-bit host and 64-bit emulated processor)


In addition, as discussed on our weekly call CR3 checks are not complete so it's probably best to focus on CR4 for this patch and split CR3 to a different one.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]