[NTOS:CM] Refactor full CPU identifier values

Dedicated to Victor Perevertkin.
This commit is contained in:
Stanislav Motylkov 2022-01-05 02:48:54 +03:00
parent 84cc81ee29
commit 77fd33c99c
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92

View file

@ -14,14 +14,7 @@
/* GLOBALS *******************************************************************/
#ifdef _M_IX86
PCHAR CmpID1 = "80%u86-%c%x";
PCHAR CmpID2 = "x86 Family %u Model %u Stepping %u";
#else
PCHAR CmpID1 = "EM64T Family %u Model %u Stepping %u";
PCHAR CmpID2 = "AMD64 Family %u Model %u Stepping %u";
PCHAR CmpID3 = "VIA64 Family %u Model %u Stepping %u";
#endif
PCHAR CmpFullCpuID = "%s Family %u Model %u Stepping %u";
PCHAR CmpBiosStrings[] =
{
"Ver",
@ -353,7 +346,7 @@ CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBloc
for (i = 0; i < KeNumberProcessors; i++)
{
#ifdef _M_AMD64
PCHAR CmpID;
PCHAR FamilyId;
#endif
/* Get the PRCB */
Prcb = KiProcessorBlock[i];
@ -370,18 +363,19 @@ CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBloc
/* Check if the CPU doesn't support CPUID */
if (!Prcb->CpuID)
{
/* Build ID1-style string for older CPUs */
/* Build 80x86-style string for older CPUs */
sprintf(Buffer,
CmpID1,
"80%u86-%c%x",
Prcb->CpuType,
(Prcb->CpuStep >> 8) + 'A',
Prcb->CpuStep & 0xff);
}
else
{
/* Build ID2-style string for newer CPUs */
/* Build full ID string for newer CPUs */
sprintf(Buffer,
CmpID2,
CmpFullCpuID,
"x86",
Prcb->CpuType,
(Prcb->CpuStep >> 8),
Prcb->CpuStep & 0xff);
@ -390,22 +384,23 @@ CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBloc
if (Prcb->CpuVendor == CPU_VIA)
{
/* This is VIA64 family */
CmpID = CmpID3;
FamilyId = "VIA64";
}
else if (Prcb->CpuVendor == CPU_AMD)
{
/* This is AMD64 family */
CmpID = CmpID2;
FamilyId = "AMD64";
}
else
{
/* This is generic EM64T family */
CmpID = CmpID1;
FamilyId = "EM64T";
}
/* ID string has the same style for all 64-bit CPUs */
sprintf(Buffer,
CmpID,
CmpFullCpuID,
FamilyId,
Prcb->CpuType,
(Prcb->CpuStep >> 8),
Prcb->CpuStep & 0xff);