Author: cwittich
Date: Sun Aug 3 19:05:14 2014
New Revision: 63798
URL:
http://svn.reactos.org/svn/reactos?rev=63798&view=rev
Log:
[ntoskrnl]
handle the case where the cpu does not support returning the brand name
CORE-7952
Modified:
trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhar…
==============================================================================
--- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] Sun Aug 3 19:05:14 2014
@@ -224,6 +224,97 @@
/* Null-terminate the version string */
BiosVersion[i] = ANSI_NULL;
return TRUE;
+}
+
+VOID
+NTAPI
+CmpGetIntelBrandString(OUT PCHAR CpuString)
+{
+ ULONG BrandId, Ebx, Signature, Dummy;
+
+ /* Get the Brand Id */
+ CPUID(0x00000001, &Signature, &Ebx, &Dummy, &Dummy);
+ BrandId = Ebx & 0xFF;
+
+ switch (BrandId)
+ {
+ case 0x01:
+ strcpy(CpuString, "Intel(R) Celeron(R) processor");
+ break;
+ case 0x02:
+ case 0x04:
+ strcpy(CpuString, "Intel(R) Pentium(R) III processor");
+ break;
+ case 0x03:
+ if(Signature == 0x000006B1)
+ strcpy(CpuString, "Intel(R) Celeron(R) processor");
+ else
+ strcpy(CpuString, "Intel(R) Pentium(R) III Xeon(R)
processor");
+ break;
+ case 0x06:
+ strcpy(CpuString, "Mobile Intel(R) Pentium(R) III Processor-M");
+ break;
+ case 0x08:
+ if(Signature >= 0x00000F13)
+ strcpy(CpuString, "Intel(R) Genuine Processor");
+ else
+ strcpy(CpuString, "Intel(R) Pentium(R) 4 processor");
+ break;
+ case 0x09:
+ strcpy(CpuString, "Intel(R) Pentium(R) 4 processor");
+ break;
+ case 0x0B:
+ if(Signature >= 0x00000F13)
+ strcpy(CpuString, "Intel(R) Xeon(R) processor");
+ else
+ strcpy(CpuString, "Intel(R) Xeon(R) processor MP");
+ break;
+ case 0x0C:
+ strcpy(CpuString, "Intel(R) Xeon(R) processor MP");
+ break;
+ case 0x0E:
+ if(Signature >= 0x00000F13)
+ strcpy(CpuString, "Mobile Intel(R) Pentium(R) 4 processor-M");
+ else
+ strcpy(CpuString, "Intel(R) Xeon(R) processor");
+ break;
+ case 0x12:
+ strcpy(CpuString, "Intel(R) Celeron(R) M processor");
+ break;
+ case 0x07:
+ case 0x0F:
+ case 0x13:
+ case 0x17:
+ strcpy(CpuString, "Mobile Intel(R) Celeron(R) processor");
+ break;
+ case 0x0A:
+ case 0x14:
+ strcpy(CpuString, "Intel(R) Celeron(R) Processor");
+ break;
+ case 0x15:
+ strcpy(CpuString, "Mobile Genuine Intel(R) Processor");
+ break;
+ case 0x16:
+ strcpy(CpuString, "Intel(R) Pentium(R) M processor");
+ break;
+ default:
+ strcpy(CpuString, "Unknown Intel processor");
+ }
+}
+
+VOID
+NTAPI
+CmpGetVendorString(IN PKPRCB Prcb, OUT PCHAR CpuString)
+{
+ /* Check if we have a Vendor String */
+ if (Prcb->VendorString[0])
+ {
+ strcpy(CpuString, Prcb->VendorString);
+ }
+ else
+ {
+ strcpy(CpuString, "Unknown x86 processor");
+ }
}
NTSTATUS
@@ -238,7 +329,7 @@
HANDLE KeyHandle, BiosHandle, SystemHandle, FpuHandle, SectionHandle;
CONFIGURATION_COMPONENT_DATA ConfigData;
CHAR Buffer[128];
- ULONG ExtendedId, Dummy;
+ ULONG VendorId, ExtendedId, Dummy;
PKPRCB Prcb;
USHORT IndexTable[MaximumType + 1] = {0};
ANSI_STRING TempString;
@@ -424,6 +515,8 @@
if (!Prcb->CpuID)
{
/* Uh oh, no CPUID! */
+ PartialString = CpuString;
+ CmpGetVendorString(Prcb, PartialString);
}
else
{
@@ -449,6 +542,23 @@
/* Null-terminate it */
CpuString[47] = ANSI_NULL;
}
+ else
+ {
+ CPUID(0x00000000, &Dummy, &VendorId, &Dummy,
&Dummy);
+ PartialString = CpuString;
+ switch (VendorId)
+ {
+ case 'uneG': /* Intel */
+ CmpGetIntelBrandString(PartialString);
+ break;
+ case 'htuA': /* AMD */
+ /* FIXME */
+ CmpGetVendorString(Prcb, PartialString);
+ break;
+ default:
+ CmpGetVendorString(Prcb, PartialString);
+ }
+ }
}
/* Go back to user affinity */