UefiCpuPkg/Application/Cpuid: Add check for gMaximumBasicFunction
authorJeff Fan <jeff.fan@intel.com>
Wed, 9 Mar 2016 02:05:30 +0000 (10:05 +0800)
committerJeff Fan <jeff.fan@intel.com>
Thu, 10 Mar 2016 01:22:54 +0000 (09:22 +0800)
Add check for gMaximumBasicFunction in CpuidVersionInfo () back.

Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
UefiCpuPkg/Application/Cpuid/Cpuid.c

index 371df66..f5268cd 100644 (file)
@@ -213,6 +213,10 @@ CpuidVersionInfo (
   UINT32                  DisplayFamily;\r
   UINT32                  DisplayModel;\r
 \r
   UINT32                  DisplayFamily;\r
   UINT32                  DisplayModel;\r
 \r
+  if (CPUID_VERSION_INFO > gMaximumBasicFunction) {\r
+    return;\r
+  }\r
+\r
   AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
 \r
   Print (L"CPUID_VERSION_INFO (Leaf %08x)\n", CPUID_VERSION_INFO);\r
   AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
 \r
   Print (L"CPUID_VERSION_INFO (Leaf %08x)\n", CPUID_VERSION_INFO);\r