Ticket #3541: haiku_ticket4427_3541_try3c.diff
File haiku_ticket4427_3541_try3c.diff, 4.2 KB (added by , 15 years ago) |
---|
-
headers/os/kernel/OS.h
482 482 B_CPU_INTEL_PENTIUM_M_MODEL_13 = 0x106d, /* Dothan */ 483 483 B_CPU_INTEL_PENTIUM_CORE, 484 484 B_CPU_INTEL_PENTIUM_CORE_2, 485 B_CPU_INTEL_PENTIUM_CORE_2_EXTREME = 0x11067, /* Core 2 Extreme or Xeon 486 model 23 on 45 nm */ 485 B_CPU_INTEL_PENTIUM_CORE_2_45_NM = 0x11067, /* Core 2 on 45 nm 486 (Core 2 Extreme, 487 Xeon model 23 or 488 Core 2 Duo/Quad) */ 487 489 B_CPU_INTEL_PENTIUM_CORE_I7 = 0x1106a, /* Core i7 920 @ 2.6(6) */ 488 490 B_CPU_INTEL_PENTIUM_IV = 0x10f0, 489 491 B_CPU_INTEL_PENTIUM_IV_MODEL_1, -
headers/private/shared/cpu_type.h
60 60 } 61 61 62 62 63 #ifdef __INTEL__ 64 /* parameter 'name' needs to point to an allocated array of 49 characters */ 65 void 66 get_cpuid_model_string(char *name) 67 { 68 /* references: 69 * 70 * http://grafi.ii.pw.edu.pl/gbm/x86/cpuid.html 71 * http://www.sandpile.org/ia32/cpuid.htm 72 * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/TN13.pdf (Duron erratum) 73 */ 74 75 cpuid_info baseInfo; 76 cpuid_info cpuInfo; 77 int32 maxStandardFunction, maxExtendedFunction = 0; 78 79 memset(name, 0, 49*sizeof(char)); 80 81 if (get_cpuid(&baseInfo, 0, 0) != B_OK) { 82 // this CPU doesn't support cpuid 83 return; 84 } 85 86 maxStandardFunction = baseInfo.eax_0.max_eax; 87 if (maxStandardFunction >= 500) 88 maxStandardFunction = 0; /* old Pentium sample chips has cpu signature here */ 89 90 /* Extended cpuid */ 91 92 get_cpuid(&cpuInfo, 0x80000000, 0); /* hardcoded to CPU 0 */ 93 94 // extended cpuid is only supported if max_eax is greater than the service id 95 if (cpuInfo.eax_0.max_eax > 0x80000000) 96 maxExtendedFunction = cpuInfo.eax_0.max_eax & 0xff; 97 98 if (maxExtendedFunction >=4 ) { 99 int32 i; 100 101 for (i = 0; i < 3; i++) { 102 cpuid_info nameInfo; 103 get_cpuid(&nameInfo, 0x80000002 + i, 0); 104 105 memcpy(name, &nameInfo.regs.eax, 4); 106 memcpy(name + 4, &nameInfo.regs.ebx, 4); 107 memcpy(name + 8, &nameInfo.regs.ecx, 4); 108 memcpy(name + 12, &nameInfo.regs.edx, 4); 109 name += 16; 110 } 111 } 112 113 return; 114 } 115 #endif // __INTEL__ 116 117 63 118 const char * 64 119 get_cpu_model_string(system_info *info) 65 120 { 121 #if __INTEL__ 122 char cpuid_name[49]; /* for use with get_cpuid_model_string() */ 123 #endif // __INTEL__ 124 66 125 // Determine CPU type 67 126 switch (info->cpu_type) { 68 127 #if __POWERPC__ … … 106 165 return "Pentium III"; 107 166 case B_CPU_INTEL_PENTIUM_M: 108 167 case B_CPU_INTEL_PENTIUM_M_MODEL_13: 168 get_cpuid_model_string(cpuid_name); 169 if (strcasestr(cpuid_name, "Celeron") != NULL) 170 return "Pentium M Celeron"; 109 171 return "Pentium M"; 110 172 case B_CPU_INTEL_ATOM: 111 173 return "Atom"; 112 174 case B_CPU_INTEL_PENTIUM_CORE: 113 175 return "Core"; 114 176 case B_CPU_INTEL_PENTIUM_CORE_2: 177 get_cpuid_model_string(cpuid_name); 178 if (strcasestr(cpuid_name, "Xeon") != NULL) 179 return "Core 2 Xeon"; 115 180 return "Core 2"; 116 case B_CPU_INTEL_PENTIUM_CORE_2_EXTREME: 181 case B_CPU_INTEL_PENTIUM_CORE_2_45_NM: 182 get_cpuid_model_string(cpuid_name); 183 if (strcasestr(cpuid_name, "Duo") != NULL || 184 strcasestr(cpuid_name, "Quad") != NULL) 185 return "Core 2"; 186 if (strcasestr(cpuid_name, "Xeon") != NULL) 187 return "Core 2 Xeon"; 117 188 return "Core 2 Extreme"; 118 189 case B_CPU_INTEL_PENTIUM_CORE_I7: 190 get_cpuid_model_string(cpuid_name); 191 if (strcasestr(cpuid_name, "Xeon") != NULL) 192 return "Core i7 Xeon"; 119 193 return "Core i7"; 120 194 case B_CPU_INTEL_PENTIUM_IV: 121 195 case B_CPU_INTEL_PENTIUM_IV_MODEL_1: 122 196 case B_CPU_INTEL_PENTIUM_IV_MODEL_2: 123 197 case B_CPU_INTEL_PENTIUM_IV_MODEL_3: 124 198 case B_CPU_INTEL_PENTIUM_IV_MODEL_4: 199 get_cpuid_model_string(cpuid_name); 200 if (strcasestr(cpuid_name, "Celeron") != NULL) 201 return "Pentium 4 Celeron"; 202 if (strcasestr(cpuid_name, "Xeon") != NULL) 203 return "Pentium 4 Xeon"; 125 204 return "Pentium 4"; 126 205 127 206 /* AMD */