]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Collect max{phys,virt}addr along with other CPUID information
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 30 Jan 2017 11:20:56 +0000 (11:20 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 30 Jan 2017 11:20:56 +0000 (11:20 +0000)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/setup.c
include/arch/x86/cpuid.h

index ea44167a61065029e0ef0d3e14bc61c783094ac3..d1c42d3dfc4f4e639c7492c2ba298df570aa8dc9 100644 (file)
@@ -20,6 +20,7 @@ uint8_t boot_stack[3 * PAGE_SIZE] __aligned(PAGE_SIZE);
 uint32_t x86_features[FSCAPINTS];
 enum x86_vendor x86_vendor;
 unsigned int x86_family, x86_model, x86_stepping;
+unsigned int maxphysaddr, maxvirtaddr;
 
 const char *environment_description = ENVIRONMENT_DESCRIPTION;
 
@@ -30,7 +31,7 @@ start_info_t *start_info = NULL;
 
 static void collect_cpuid(cpuid_count_fn_t cpuid_fn)
 {
-    unsigned int max, tmp, eax, ebx, ecx, edx;
+    unsigned int max, tmp, eax, ebx, ecx, edx, addr = 0;
 
     cpuid_fn(0, 0, &max, &ebx, &ecx, &edx);
 
@@ -86,10 +87,13 @@ static void collect_cpuid(cpuid_count_fn_t cpuid_fn)
             cpuid_fn(0x80000007, 0, &tmp, &tmp, &tmp,
                      &x86_features[FEATURESET_e7d]);
         if ( max >= 0x80000008 )
-            cpuid_fn(0x80000008, 0, &tmp,
+            cpuid_fn(0x80000008, 0, &addr,
                      &x86_features[FEATURESET_e8b],
                      &tmp, &tmp);
     }
+
+    maxphysaddr = (addr & 0xff) ?: 36;
+    maxvirtaddr = ((addr >> 8) & 0xff) ?: 32;
 }
 
 /*
index 7b06763b6d2f21b72733a54e896f0913a0ca46d2..14a7823e313770b6c722ac485c80bd26d8093ada 100644 (file)
@@ -22,6 +22,7 @@ enum x86_vendor
 
 extern enum x86_vendor x86_vendor;
 extern unsigned int x86_family, x86_model, x86_stepping;
+extern unsigned int maxphysaddr, maxvirtaddr;
 
 static inline bool vendor_is(enum x86_vendor v)
 {