mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTOS:KE] Fix CPU extended family and model detection
Based on documentation from Geoff Chappell: https://www.geoffchappell.com/studies/windows/km/cpu/cpuid/00000001h/eax.htm CORE-17974
This commit is contained in:
parent
00b3e4bc68
commit
fa52f2fae0
2 changed files with 50 additions and 2 deletions
|
@ -98,7 +98,11 @@ KiSetProcessorType(VOID)
|
|||
{
|
||||
CPU_INFO CpuInfo;
|
||||
CPU_SIGNATURE CpuSignature;
|
||||
ULONG Stepping, Type;
|
||||
BOOLEAN ExtendModel;
|
||||
ULONG Stepping, Type, Vendor;
|
||||
|
||||
/* This initializes Prcb->CpuVendor */
|
||||
Vendor = KiGetCpuVendor();
|
||||
|
||||
/* Do CPUID 1 now */
|
||||
KiCpuId(&CpuInfo, 1);
|
||||
|
@ -111,8 +115,29 @@ KiSetProcessorType(VOID)
|
|||
*/
|
||||
CpuSignature.AsULONG = CpuInfo.Eax;
|
||||
Stepping = CpuSignature.Model;
|
||||
ExtendModel = (CpuSignature.Family == 15);
|
||||
#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
|
||||
if (CpuSignature.Family == 6)
|
||||
{
|
||||
ExtendModel |= (Vendor == CPU_INTEL);
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
ExtendModel |= (Vendor == CPU_CENTAUR);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (ExtendModel)
|
||||
{
|
||||
/* Add ExtendedModel to distinguish from non-extended values. */
|
||||
Stepping |= (CpuSignature.ExtendedModel << 4);
|
||||
}
|
||||
Stepping = (Stepping << 8) | CpuSignature.Step;
|
||||
Type = CpuSignature.Family;
|
||||
if (CpuSignature.Family == 15)
|
||||
{
|
||||
/* Add ExtendedFamily to distinguish from non-extended values.
|
||||
* It must not be larger than 0xF0 to avoid overflow. */
|
||||
Type += min(CpuSignature.ExtendedFamily, 0xF0);
|
||||
}
|
||||
|
||||
/* Save them in the PRCB */
|
||||
KeGetCurrentPrcb()->CpuID = TRUE;
|
||||
|
@ -130,7 +155,7 @@ KiGetFeatureBits(VOID)
|
|||
CPU_INFO CpuInfo;
|
||||
|
||||
/* Get the Vendor ID */
|
||||
Vendor = KiGetCpuVendor();
|
||||
Vendor = Prcb->CpuVendor;
|
||||
|
||||
/* Make sure we got a valid vendor ID at least. */
|
||||
if (!Vendor) return FeatureBits;
|
||||
|
|
|
@ -159,6 +159,7 @@ KiSetProcessorType(VOID)
|
|||
{
|
||||
CPU_INFO CpuInfo;
|
||||
CPU_SIGNATURE CpuSignature;
|
||||
BOOLEAN ExtendModel;
|
||||
ULONG Stepping, Type;
|
||||
|
||||
/* Do CPUID 1 now */
|
||||
|
@ -172,8 +173,30 @@ KiSetProcessorType(VOID)
|
|||
*/
|
||||
CpuSignature.AsULONG = CpuInfo.Eax;
|
||||
Stepping = CpuSignature.Model;
|
||||
ExtendModel = (CpuSignature.Family == 15);
|
||||
#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
|
||||
if (CpuSignature.Family == 6)
|
||||
{
|
||||
ULONG Vendor = KiGetCpuVendor();
|
||||
ExtendModel |= (Vendor == CPU_INTEL);
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
ExtendModel |= (Vendor == CPU_CENTAUR);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (ExtendModel)
|
||||
{
|
||||
/* Add ExtendedModel to distinguish from non-extended values. */
|
||||
Stepping |= (CpuSignature.ExtendedModel << 4);
|
||||
}
|
||||
Stepping = (Stepping << 8) | CpuSignature.Step;
|
||||
Type = CpuSignature.Family;
|
||||
if (CpuSignature.Family == 15)
|
||||
{
|
||||
/* Add ExtendedFamily to distinguish from non-extended values.
|
||||
* It must not be larger than 0xF0 to avoid overflow. */
|
||||
Type += min(CpuSignature.ExtendedFamily, 0xF0);
|
||||
}
|
||||
|
||||
/* Save them in the PRCB */
|
||||
KeGetCurrentPrcb()->CpuID = TRUE;
|
||||
|
|
Loading…
Reference in a new issue