[v1.02][x86] Suport for detecting hybrid_flag

This commit is contained in:
Dr-Noob
2022-10-20 20:49:10 +00:00
parent e91eef3e65
commit 051d48b7d1
2 changed files with 13 additions and 0 deletions

View File

@@ -131,6 +131,8 @@ struct cpuInfo {
uint32_t maxExtendedLevels; uint32_t maxExtendedLevels;
// Topology Extensions (AMD only) // Topology Extensions (AMD only)
bool topology_extensions; bool topology_extensions;
// Hybrid Flag (Intel only)
bool hybrid_flag;
#elif ARCH_PPC #elif ARCH_PPC
uint32_t pvr; uint32_t pvr;
#elif ARCH_ARM #elif ARCH_ARM

View File

@@ -401,6 +401,14 @@ struct cpuInfo* get_cpu_info() {
cpu->topology_extensions = (ecx >> 22) & 1; cpu->topology_extensions = (ecx >> 22) & 1;
} }
cpu->hybrid_flag = false;
if(cpu->cpu_vendor == CPU_VENDOR_INTEL && cpu->maxLevels >= 0x00000007) {
eax = 0x00000007;
ecx = 0x00000000;
cpuid(&eax, &ebx, &ecx, &edx);
cpu->hybrid_flag = (edx >> 15) & 0x1;
}
// If any field of the struct is NULL, // If any field of the struct is NULL,
// return inmideately, as further functions // return inmideately, as further functions
// require valid fields (cach, topo, etc) // require valid fields (cach, topo, etc)
@@ -931,6 +939,9 @@ void print_debug(struct cpuInfo* cpu) {
if(cpu->cpu_vendor == CPU_VENDOR_AMD) { if(cpu->cpu_vendor == CPU_VENDOR_AMD) {
printf("- AMD topology extensions: %d\n", cpu->topology_extensions); printf("- AMD topology extensions: %d\n", cpu->topology_extensions);
} }
if(cpu->cpu_vendor == CPU_VENDOR_INTEL) {
printf("- Hybrid Flag: %d\n", cpu->hybrid_flag);
}
printf("- CPUID dump: 0x%.8X\n", eax); printf("- CPUID dump: 0x%.8X\n", eax);
free_cpuinfo_struct(cpu); free_cpuinfo_struct(cpu);