]> xenbits.xensource.com Git - xcp/xen-api-libs.git/commitdiff
Add Cpuid.features_mask function.
authorRob Hoes <rob.hoes@citrix.com>
Mon, 29 Mar 2010 09:47:47 +0000 (10:47 +0100)
committerRob Hoes <rob.hoes@citrix.com>
Mon, 29 Mar 2010 09:47:47 +0000 (10:47 +0100)
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
cpuid/cpuid.ml
cpuid/cpuid.mli

index 6f332b77dbdc880a7a82617ff78c5d5fe3e36eed..04cf46ba4d456238718ed71811a508bc97463d27 100644 (file)
@@ -181,6 +181,14 @@ let read_cpu_info () =
        
 (* === Masking checks === *)
 
+let mask_features features mask =
+       {
+               base_ecx = logand features.base_ecx mask.base_ecx;
+               base_edx = logand features.base_edx mask.base_edx;
+               ext_ecx = logand features.ext_ecx mask.ext_ecx;
+               ext_edx = logand features.ext_edx mask.ext_edx;
+       }
+
 let assert_maskability cpu manufacturer features = 
        (* Manufacturers need to be the same *)
        if manufacturer != cpu.manufacturer then 
index 7f9e800c85f506afbc26e0099644e40f05787cbf..447b1b59dc080ccba868adf8177a8d7a1759c5c3 100644 (file)
@@ -54,8 +54,11 @@ val read_cpu_info : unit -> cpu_info
 
 (** {2 Masking Checks} *)
 
-(** Check that this CPU can be masked to fit the pool. Raises {!CannotMaskCpu} 
- *  including a reason string if this is not possible. *)
+(** Apply a mask to given features. *)
+val mask_features : features -> features -> features
+
+(** Check that this CPU can be masked to fit the pool. Raises exception
+ *  indicating the reason if this is not possible. *)
 val assert_maskability : cpu_info -> manufacturer -> features -> unit
 
 (** Return the CPU masking string to add to the Xen command-line,