WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: Update xen-detect utility to scan fo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Update xen-detect utility to scan for Xen signature in CPUID space.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 16 Dec 2008 22:31:26 -0800
Delivery-date: Tue, 16 Dec 2008 22:33:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1229429053 0
# Node ID fd720db486755948daf39046e7fa2941ac78d377
# Parent  86db039882eaa71d824ba5fd68abd83da82a77e9
x86: Update xen-detect utility to scan for Xen signature in CPUID space.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/misc/xen-detect.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff -r 86db039882ea -r fd720db48675 tools/misc/xen-detect.c
--- a/tools/misc/xen-detect.c   Tue Dec 16 12:00:25 2008 +0000
+++ b/tools/misc/xen-detect.c   Tue Dec 16 12:04:13 2008 +0000
@@ -50,17 +50,25 @@ static int check_for_xen(void)
 {
     uint32_t eax, ebx, ecx, edx;
     char signature[13];
+    uint32_t base;
 
-    cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
-    *(uint32_t *)(signature + 0) = ebx;
-    *(uint32_t *)(signature + 4) = ecx;
-    *(uint32_t *)(signature + 8) = edx;
-    signature[12] = '\0';
+    for ( base = 0x40000000; base < 0x40001000; base += 0x100 )
+    {
+        cpuid(base, &eax, &ebx, &ecx, &edx);
 
-    if ( strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002) )
-        return 0;
+        *(uint32_t *)(signature + 0) = ebx;
+        *(uint32_t *)(signature + 4) = ecx;
+        *(uint32_t *)(signature + 8) = edx;
+        signature[12] = '\0';
 
-    cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
+        if ( !strcmp("XenVMMXenVMM", signature) && (eax >= (base + 2)) )
+            goto found;
+    }
+
+    return 0;
+
+ found:
+    cpuid(base + 1, &eax, &ebx, &ecx, &edx);
     printf("Running in %s context on Xen v%d.%d.\n",
            pv_context ? "PV" : "HVM", (uint16_t)(eax >> 16), (uint16_t)eax);
     return 1;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Update xen-detect utility to scan for Xen signature in CPUID space., Xen patchbot-unstable <=