[PATCH 3/8] ntdll: Handle CPU Level (family) as a vendor specific component.

James Eder jimportal at gmail.com
Sat Oct 20 19:40:45 CDT 2012


AMD says to add the extended family to the family if family is 0xf.

Intel says to add the extended family to the family (although all Intel
chips that I know of have 0s for the the extended family bits).

Other vendors list the extended family bits as reserved.
---
 dlls/ntdll/nt.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 80a9f3e..ba4647c 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -878,19 +878,6 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
     if (regs[0]>=0x00000001)   /* Check for supported cpuid version */
     {
         do_cpuid(0x00000001, regs2); /* get cpu features */
-        switch ((regs2[0] >> 8) & 0xf)  /* cpu family */
-        {
-        case 3: info->Level = 3;        break;
-        case 4: info->Level = 4;        break;
-        case 5: info->Level = 5;        break;
-        case 15: /* PPro/2/3/4 has same info as P1 */
-        case 6: info->Level = 6;         break;
-        default:
-            FIXME("unknown cpu family %d, please report! (-> setting to 386)\n",
-                  (regs2[0] >> 8)&0xf);
-            info->Level = 3;
-            break;
-        }
 
         if(regs2[3] & (1 << 3 )) info->FeatureSet |= CPU_FEATURE_PSE;
         if(regs2[3] & (1 << 4 )) info->FeatureSet |= CPU_FEATURE_TSC;
@@ -917,6 +904,10 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
 
         if (regs[1] == AUTH && regs[3] == ENTI && regs[2] == CAMD)
         {
+            info->Level = (regs2[0] >> 8) & 0xf; /* family */
+            if (info->Level == 0xf)  /* AMD says to add the extended family to the family if family is 0xf */
+                info->Level += (regs2[0] >> 20) & 0xff;
+
             do_cpuid(0x80000000, regs);  /* get vendor cpuid level */
             if (regs[0] >= 0x80000001)
             {
@@ -929,6 +920,9 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
         }
         else if (regs[1] == GENU && regs[3] == INEI && regs[2] == NTEL)
         {
+            info->Level = ((regs2[0] >> 8) & 0xf) + ((regs2[0] >> 20) & 0xff); /* family + extended family */
+            if(info->Level == 15) info->Level = 6;
+
             if(regs2[3] & (1 << 21)) info->FeatureSet |= CPU_FEATURE_DS;
             user_shared_data->ProcessorFeatures[PF_VIRT_FIRMWARE_ENABLED] = (regs2[2] & (1 << 5 )) >> 5;
 
@@ -939,6 +933,10 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
                 user_shared_data->ProcessorFeatures[PF_NX_ENABLED] = (regs2[3] & (1 << 20 )) >> 20;
             }
         }
+        else
+        {
+            info->Level = (regs2[0] >> 8) & 0xf; /* family */
+        }
     }
 }
 
-- 
1.7.12.4




More information about the wine-patches mailing list