From: Keir Fraser Subject: Re: Problem with CPUID getting information in hvm guest Date: Wed, 2 Jun 2010 21:07:55 +0100 Message-ID: References: <287979.35585.qm@web92405.mail.cnh.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <287979.35585.qm@web92405.mail.cnh.yahoo.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: =?GB2312?B?uvrJ2cH6?= , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Take a look at tools/misc/xen-detect.c in the Xen sources. -- Keir On 17/05/2010 03:39, "=BA=FA=C9=D9=C1=FA" 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 ,i= s > some thing changed ? Thx. > =20 > #include > #include > #include > typedef union > { > uint32_t r[3]; > char string[12]; > }cpuid_t; > #define CPUID(command,result) \ > __asm __volatile(\ > "CPUID"\ > : "=3Db"(result.r[0]),"=3Dc"(cpu.r[1]),"=3Dd"(cpu.r[2])\ > : "a"(command)); > int main(void) > { > cpuid_t cpu; > CPUID(0,cpu); > printf("cpu.string=3D%s\n",cpu.string); > if(strncmp(cpu.string,"XenVMMXenVMM",12)=3D=3D0) > { > printf("Running as a Xen HVM guest\n"); > } > else > { > printf("Running on native hardware or a non Xen hypervisor\n"); > } > return 0; > } >=20 > =20