pub fn from_host_cpuid() -> Result<Self, Error> {
        let mut this = Self::new();
        let mut cpuid_regs = unsafe { host_cpuid(0x8000_0000) };

        if cpuid_regs.eax < 0x8000_0004 {
            // Brand string not supported by the host CPU
            return Err(Error::NotSupported);
        }

        for leaf in 0x8000_0002..=0x8000_0004 {
            cpuid_regs = unsafe { host_cpuid(leaf) };
            this.set_reg_for_leaf(leaf, Reg::Eax, cpuid_regs.eax);
            this.set_reg_for_leaf(leaf, Reg::Ebx, cpuid_regs.ebx);
            this.set_reg_for_leaf(leaf, Reg::Ecx, cpuid_regs.ecx);
            this.set_reg_for_leaf(leaf, Reg::Edx, cpuid_regs.edx);
        }

        this.len = null_terminator_index(this.as_bytes());

        Ok(this)
    }
/// Creates a brand string, initialized from the CPUID leaves 0x80000002 through 0x80000004
/// of the host CPU.
Creates a brand string, initialized from the CPUID leaves 0x80000002 through 0x80000004
of the host CPU.
Creates a brand string initialized from the CPUID leaves 0x80000002 through 0x80000004 of the host CPU .
pub fn from_host_cpuid() -> Result<Self, Error> {
        let mut this = Self::new();
        let mut cpuid_regs = unsafe { host_cpuid(0x8000_0000) };
        if cpuid_regs.eax < 0x8000_0004 {
            // Brand string not supported by the host CPU
            return Err(Error::NotSupported);
        }
        for leaf in 0x8000_0002..=0x8000_0004 {
            cpuid_regs = unsafe { host_cpuid(leaf) };
            this.set_reg_for_leaf(leaf, Reg::Eax, cpuid_regs.eax);
            this.set_reg_for_leaf(leaf, Reg::Ebx, cpuid_regs.ebx);
            this.set_reg_for_leaf(leaf, Reg::Ecx, cpuid_regs.ecx);
            this.set_reg_for_leaf(leaf, Reg::Edx, cpuid_regs.edx);
        }
        this.len = null_terminator_index(this.as_bytes());
        Ok(this)
    }
pub fn from_host_cpuid ( ) -> Result < Self , Error > { let mut this = Self :: new ( ) ; let mut cpuid_regs = unsafe { host_cpuid ( 0x8000_0000 ) } ; if cpuid_regs . eax < 0x8000_0004 { // Brand string not supported by the host CPU return Err ( Error :: NotSupported ) ; } for leaf in 0x8000_0002 ..= 0x8000_0004 { cpuid_regs = unsafe { host_cpuid ( leaf ) } ; this . set_reg_for_leaf ( leaf , Reg :: Eax , cpuid_regs . eax ) ; this . set_reg_for_leaf ( leaf , Reg :: Ebx , cpuid_regs . ebx ) ; this . set_reg_for_leaf ( leaf , Reg :: Ecx , cpuid_regs . ecx ) ; this . set_reg_for_leaf ( leaf , Reg :: Edx , cpuid_regs . edx ) ; } this . len = null_terminator_index ( this . as_bytes ( ) ) ; Ok ( this ) }
Creates a brand string, initialized from the CPUID leaves 0x80000002 through 0x80000004
of the host CPU.
Creates a brand string initialized from the CPUID leaves 0x80000002 through 0x80000004 of the host CPU .