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-devel

Re: [Xen-devel] Problem with CPUID getting information in hvm guest

To: 胡少龙 <sunofblack@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Problem with CPUID getting information in hvm guest
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Wed, 2 Jun 2010 21:07:55 +0100
Cc:
Delivery-date: Wed, 02 Jun 2010 13:27:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <287979.35585.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcsCecpdhZd8JbSURQGOfoU2WPyn1gAFX9TJ
Thread-topic: [Xen-devel] Problem with CPUID getting information in hvm guest
User-agent: Microsoft-Entourage/12.24.0.100205
Take a look at tools/misc/xen-detect.c in the Xen sources.

 -- Keir

On 17/05/2010 03:39, "胡少龙" <sunofblack@xxxxxxxx> wrote:

> Hi,
> I am using fellowing code get xen vmm string , but came out with
> "GenuntelineI", not "XenVMMXenVMM", i am using xen 3.41 on ubuntu 8.04 ,is
> some thing changed ? Thx.
>  
> #include <stdio.h>
> #include <inttypes.h>
> #include <string.h>
> typedef union
> {
>  uint32_t r[3];
>  char string[12];
> }cpuid_t;
> #define CPUID(command,result) \
>     __asm __volatile(\
>   "CPUID"\
>   : "=b"(result.r[0]),"=c"(cpu.r[1]),"=d"(cpu.r[2])\
>   : "a"(command));
> int main(void)
> {
>  cpuid_t cpu;
>  CPUID(0,cpu);
>  printf("cpu.string=%s\n",cpu.string);
>  if(strncmp(cpu.string,"XenVMMXenVMM",12)==0)
>  {
>   printf("Running as a Xen HVM guest\n");
>  }
>  else
>  {
>   printf("Running on native hardware or a non Xen hypervisor\n");
>  }
>  return 0;
> }
> 
>   



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

<Prev in Thread] Current Thread [Next in Thread>