/// <summary> /// Initializes a new instance of the <see cref="CpuId" /> class. /// </summary> /// <param name="group">The group.</param> /// <param name="thread">The thread.</param> /// <param name="affinity">The affinity.</param> private CpuId(int group, int thread, GroupAffinity affinity) { Thread = thread; Group = group; Affinity = affinity; uint threadMaskWith; uint coreMaskWith; uint maxCpuidExt; if (thread >= 64) { throw new ArgumentOutOfRangeException(nameof(thread)); } uint maxCpuid; if (OpCode.CpuId(CPUID_0, 0, out uint eax, out uint ebx, out uint ecx, out uint edx)) { if (eax > 0) { maxCpuid = eax; } else { return; } StringBuilder vendorBuilder = new StringBuilder(); AppendRegister(vendorBuilder, ebx); AppendRegister(vendorBuilder, edx); AppendRegister(vendorBuilder, ecx); string cpuVendor = vendorBuilder.ToString(); switch (cpuVendor) { case "GenuineIntel": Vendor = Vendor.Intel; break; case "AuthenticAMD": Vendor = Vendor.AMD; break; default: Vendor = Vendor.Unknown; break; } if (OpCode.CpuId(CPUID_EXT, 0, out eax, out _, out _, out _)) { if (eax > CPUID_EXT) { maxCpuidExt = eax - CPUID_EXT; } else { return; } } else { throw new ArgumentOutOfRangeException(nameof(thread)); } }