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] Native hypercall basics using int 82

To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Native hypercall basics using int 82
From: "hnrkssn hnrkssn" <hnrkssn@xxxxxxxxx>
Date: Tue, 16 Dec 2008 16:04:42 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 16 Dec 2008 07:05:16 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=xnjh3o9//EQaAViEchIOPWIef8jTrlnp2Gc4RbeOjLM=; b=TwOH4PsJMXOoZqG6F0B52iujo9YTntH8KaFLBAKz/aBHTyCGmUuDE0VKWbEc5O9efU U8Yn46jlSHR534uljH0FTxbgns9pMRhRZF7pMjZxofW0tecEh+iHnmOJT/nigbZW97XI aiEcOYzKKrPv6IlDEl2uGCEMQD5CU8/nguHYs=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=ArkIK1BkiL1/+QJuyDlWeQhP+lcxsZNG2CHXoX9e8/hdpxPmntwfwEer0kcGtwxKzg CFGAmM0BzIGQjetSxPzQA3Nj6DZPg0nvxn6froBpL+XdOSjpz6iFUtN0N5Bzmn60tJ8G 2cFByJrnpX7PvseFkFhjsQiSkwNoXIGoNHJrU=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C56D3A8C.20442%keir.fraser@xxxxxxxxxxxxx>
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>
References: <6a3ccf200812160233u7d435ccck6bf1b5490f97c276@xxxxxxxxxxxxxx> <C56D3A8C.20442%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thanks,
It's working like a charm.

A background question, why does it "emulate Hyper-V"? Is it configurable?


Regards
David

On Tue, Dec 16, 2008 at 11:59 AM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
We relocate the Xen CPUID info when we emulate Hyper-V. You need to scan for the Xen signature — starting at 0x40000000 and then every 0x100 up to 0x40001000. If you find the signature then you have found the contiguous range of Xen CPUID leaves. I should fix xen-detect.c to do this scan.

 -- Keir


On 16/12/2008 10:33, "hnrkssn hnrkssn" <hnrkssn@xxxxxxxxx> wrote:

I have already tried the CPUID approach used in xen-detect.c
When I read the info from leaf 0x40000001, it says "Microsoft Hv" when I run it on Citrix XenServer Express Edition.
I thought "Microsoft Hv" was supposed to identify Hyper-V?

So I have to try another method.
Can anybody give me some hints on my assembler example in the initial post for making a hypercall?

---
char buffer[256];
HYPERCALL hypercall;
PHYPERCALL phypercall = &hypercall;

hypercall.op     = 17;                       // xen_version
hypercall.arg[0] = (unsigned long) 1; // xen_extra_version
hypercall.arg[1] = (unsigned long) Buffer;

memset(Buffer, 0, sizeof(Buffer));

_asm
  {
    MOV EAX, phypercall;
    INT 82;
  }

  Buffer[255] = '\0';
  
  Cprintf("Buf: %s\r\n", Buffer);



Best Regards,
David

On Tue, Dec 16, 2008 at 9:47 AM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
On 16/12/2008 08:39, "hnrkssn hnrkssn" <hnrkssn@xxxxxxxxx> wrote:

> I'm trying to detect if I'm running as a guest in XEN hypervisor using a
> simple hypercall like __HYPERVISOR_xen_version with the XENVER_extraversion
> option.
> I cannot use any of the API functions for this so I'm trying to setup the
> required registers and call int 82 myself.
> This is what I do and unfortunately, it generates an exception 0xd when
> executing INT 82.
>
> Reading the source, I think I've figured out that I should put my arguments in
> a hypercall struct shown below. I might be wrong then.

See tools/misc/xen-detect.c for a nice approach that even works from user
space.

 -- Keir





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