[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 6/7] x86/hvm: Add SMAP support to HVM guest
On 23/04/14 15:37, Feng Wu wrote: > > /* Go back and set accessed and dirty bits only if the walk was a > diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h > index 74a09ef..8dbb3f0 100644 > --- a/xen/include/asm-x86/hvm/hvm.h > +++ b/xen/include/asm-x86/hvm/hvm.h > @@ -257,6 +257,8 @@ int hvm_girq_dest_2_vcpu_id(struct domain *d, uint8_t > dest, uint8_t dest_mode); > (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE)) > #define hvm_smep_enabled(v) \ > (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & > X86_CR4_SMEP)) > +#define hvm_smap_enabled(v) \ > + (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & > X86_CR4_SMAP)) > #define hvm_nx_enabled(v) \ > (!!((v)->arch.hvm_vcpu.guest_efer & EFER_NX)) > > @@ -360,6 +362,15 @@ static inline bool_t hvm_vcpu_has_smep(void) > return !!(ebx & cpufeat_mask(X86_FEATURE_SMEP)); > } > > +static inline bool_t hvm_vcpu_has_smap(void) > +{ > + unsigned int ebx = 0, leaf = 0x7; > + > + hvm_cpuid(leaf, NULL, &ebx, NULL, NULL); Same review as the SMEP fix earlier in the series. ~Andrew > + > + return !!(ebx & cpufeat_mask(X86_FEATURE_SMAP)); > +} > + > /* These reserved bits in lower 32 remain 0 after any load of CR0 */ > #define HVM_CR0_GUEST_RESERVED_BITS \ > (~((unsigned long) \ > @@ -380,6 +391,7 @@ static inline bool_t hvm_vcpu_has_smep(void) > X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \ > X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | \ > (hvm_vcpu_has_smep() ? X86_CR4_SMEP : 0) | \ > + (hvm_vcpu_has_smap() ? X86_CR4_SMAP : 0) | \ > (cpu_has_fsgsbase ? X86_CR4_FSGSBASE : 0) | \ > ((nestedhvm_enabled((_v)->domain) && cpu_has_vmx)\ > ? X86_CR4_VMXE : 0) | \ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |