1*eca53ba6SRoland Levillain // Copyright 2017 Google LLC 2*eca53ba6SRoland Levillain // 3*eca53ba6SRoland Levillain // Licensed under the Apache License, Version 2.0 (the "License"); 4*eca53ba6SRoland Levillain // you may not use this file except in compliance with the License. 5*eca53ba6SRoland Levillain // You may obtain a copy of the License at 6*eca53ba6SRoland Levillain // 7*eca53ba6SRoland Levillain // http://www.apache.org/licenses/LICENSE-2.0 8*eca53ba6SRoland Levillain // 9*eca53ba6SRoland Levillain // Unless required by applicable law or agreed to in writing, software 10*eca53ba6SRoland Levillain // distributed under the License is distributed on an "AS IS" BASIS, 11*eca53ba6SRoland Levillain // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*eca53ba6SRoland Levillain // See the License for the specific language governing permissions and 13*eca53ba6SRoland Levillain // limitations under the License. 14*eca53ba6SRoland Levillain 15*eca53ba6SRoland Levillain #ifndef CPU_FEATURES_INCLUDE_INTERNAL_CPUID_X86_H_ 16*eca53ba6SRoland Levillain #define CPU_FEATURES_INCLUDE_INTERNAL_CPUID_X86_H_ 17*eca53ba6SRoland Levillain 18*eca53ba6SRoland Levillain #include <stdint.h> 19*eca53ba6SRoland Levillain 20*eca53ba6SRoland Levillain #include "cpu_features_macros.h" 21*eca53ba6SRoland Levillain 22*eca53ba6SRoland Levillain CPU_FEATURES_START_CPP_NAMESPACE 23*eca53ba6SRoland Levillain 24*eca53ba6SRoland Levillain // A struct to hold the result of a call to cpuid. 25*eca53ba6SRoland Levillain typedef struct { 26*eca53ba6SRoland Levillain uint32_t eax, ebx, ecx, edx; 27*eca53ba6SRoland Levillain } Leaf; 28*eca53ba6SRoland Levillain 29*eca53ba6SRoland Levillain // Returns the result of a call to the cpuid instruction. 30*eca53ba6SRoland Levillain Leaf GetCpuidLeaf(uint32_t leaf_id, int ecx); 31*eca53ba6SRoland Levillain 32*eca53ba6SRoland Levillain // Returns the eax value of the XCR0 register. 33*eca53ba6SRoland Levillain uint32_t GetXCR0Eax(void); 34*eca53ba6SRoland Levillain 35*eca53ba6SRoland Levillain CPU_FEATURES_END_CPP_NAMESPACE 36*eca53ba6SRoland Levillain 37*eca53ba6SRoland Levillain #endif // CPU_FEATURES_INCLUDE_INTERNAL_CPUID_X86_H_ 38