1// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. 2 3//+build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine 4 5package cpuid 6 7func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32) 8func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) 9func asmXgetbv(index uint32) (eax, edx uint32) 10func asmRdtscpAsm() (eax, ebx, ecx, edx uint32) 11 12func initCPU() { 13 cpuid = asmCpuid 14 cpuidex = asmCpuidex 15 xgetbv = asmXgetbv 16 rdtscpAsm = asmRdtscpAsm 17} 18 19func addInfo(c *CPUInfo, safe bool) { 20 c.maxFunc = maxFunctionID() 21 c.maxExFunc = maxExtendedFunction() 22 c.BrandName = brandName() 23 c.CacheLine = cacheLine() 24 c.Family, c.Model = familyModel() 25 c.featureSet = support() 26 c.SGX = hasSGX(c.featureSet.inSet(SGX), c.featureSet.inSet(SGXLC)) 27 c.ThreadsPerCore = threadsPerCore() 28 c.LogicalCores = logicalCores() 29 c.PhysicalCores = physicalCores() 30 c.VendorID, c.VendorString = vendorID() 31 c.Hz = hertz(c.BrandName) 32 c.cacheSize() 33} 34