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@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Jun-02 20:07 UTC
Re: [Xen-devel] Problem with CPUID getting information in hvm guest
Take a look at tools/misc/xen-detect.c in the Xen sources. -- Keir On 17/05/2010 03:39, "胡少龙" <sunofblack@yahoo.cn> 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@lists.xensource.com http://lists.xensource.com/xen-devel