pub fn use_host_cpuid_function(
    cpuid: &mut CpuId,
    function: u32,
    use_count: bool,
) -> Result<(), Error> {
    // copy all the CpuId entries, except for the ones with the provided function
    cpuid.retain(|entry| entry.function != function);

    // add all the host leaves with the provided function
    let mut count: u32 = 0;
    while let Ok(entry) = get_cpuid(function, count) {
        if count > 0 && !use_count {
            break;
        }

        cpuid
            .push(kvm_cpuid_entry2 {
                function,
                index: count,
                flags: 0,
                eax: entry.eax,
                ebx: entry.ebx,
                ecx: entry.ecx,
                edx: entry.edx,
                padding: [0, 0, 0],
            })
            .map_err(FamError)?;

        count += 1;
    }

    Ok(())
}
/// Replaces the `cpuid` entries corresponding to `function` with the entries from the host's cpuid.
Replaces the `cpuid` entries corresponding to `function` with the entries from the host's cpuid.
Replaces the ` cpuid ` entries corresponding to ` function ` with the entries from the host ' s cpuid .
pub fn use_host_cpuid_function(
    cpuid: &mut CpuId,
    function: u32,
    use_count: bool,
) -> Result<(), Error> {
    // copy all the CpuId entries, except for the ones with the provided function
    cpuid.retain(|entry| entry.function != function);
    // add all the host leaves with the provided function
    let mut count: u32 = 0;
    while let Ok(entry) = get_cpuid(function, count) {
        if count > 0 && !use_count {
            break;
        }
        cpuid
            .push(kvm_cpuid_entry2 {
                function,
                index: count,
                flags: 0,
                eax: entry.eax,
                ebx: entry.ebx,
                ecx: entry.ecx,
                edx: entry.edx,
                padding: [0, 0, 0],
            })
            .map_err(FamError)?;
        count += 1;
    }
    Ok(())
}
pub fn use_host_cpuid_function ( cpuid : & mut CpuId , function : u32 , use_count : bool , ) -> Result < ( ) , Error > { // copy all the CpuId entries, except for the ones with the provided function cpuid . retain ( | entry | entry . function != function ) ; // add all the host leaves with the provided function let mut count : u32 = 0 ; while let Ok ( entry ) = get_cpuid ( function , count ) { if count > 0 && ! use_count { break ; } cpuid . push ( kvm_cpuid_entry2 { function , index : count , flags : 0 , eax : entry . eax , ebx : entry . ebx , ecx : entry . ecx , edx : entry . edx , padding : [ 0 , 0 , 0 ] , } ) . map_err ( FamError ) ? ; count += 1 ; } Ok ( ( ) ) }
Replaces the `cpuid` entries corresponding to `function` with the entries from the host's cpuid.
Replaces the ` cpuid ` entries corresponding to ` function ` with the entries from the host ' s cpuid .
cpuid
&mut CpuId
function
u32
use_count
bool
cpuid
&mut CpuId
function
u32
use_count
bool