https://git.reactos.org/?p=reactos.git;a=commitdiff;h=77fd33c99c79d6bd7b6a5…
commit 77fd33c99c79d6bd7b6a5a299f11e3aebffd0de4
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Wed Jan 5 02:48:54 2022 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Wed Jan 5 18:28:40 2022 +0300
[NTOS:CM] Refactor full CPU identifier values
Dedicated to Victor Perevertkin.
---
ntoskrnl/config/i386/cmhardwr.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/ntoskrnl/config/i386/cmhardwr.c b/ntoskrnl/config/i386/cmhardwr.c
index 1810da6a53b..235250d7076 100644
--- a/ntoskrnl/config/i386/cmhardwr.c
+++ b/ntoskrnl/config/i386/cmhardwr.c
@@ -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);