[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Native hypercall basics using int 82

  • To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>
  • From: "hnrkssn hnrkssn" <hnrkssn@xxxxxxxxx>
  • Date: Tue, 16 Dec 2008 11:33:10 +0100
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 16 Dec 2008 02:33:36 -0800
  • 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=ErAApDA+o/9QBiiELhQwhnwZ7Ag9ILmwAlPNZ9yVPcF/9vVdENcxN5Vw/7q7DiycEy hOxIlulolFSpONwu6MYVMso9ffdB+6RvJcGYY63dvKuMMuuT7qc8LgKl5fsytnrQIHRh OYvaWzxGxwMxNa+l1i+BOJBO2R6nKsfRibwOo=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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));

    MOV EAX, phypercall;
    INT 82;

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

Best Regards,

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

 -- Keir

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.