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/
Home Products Support Community News


RE: [Xen-devel] testing hypercall from windows - what's the most basic c

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] testing hypercall from windows - what's the most basic call I can make to test
From: "James Harper" <james.harper@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Sep 2007 22:51:47 +1000
Delivery-date: Tue, 25 Sep 2007 05:53:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C31D895D.15E71%Keir.Fraser@xxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <AEC6C66638C05B468B556EA548C1A77D0124982F@trantor> <C31D895D.15E71%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acf+rpm9QXpClAmUQGKlPQ11YJlmywACVHy5ACoJVuA=
Thread-topic: [Xen-devel] testing hypercall from windows - what's the most basic call I can make to test
> As for the simplest hypercall, that is xen_version.

Am I correct in saying that 'HYPERVISOR_xen_version(0, NULL)' is a
benign call, and that if the system doesn't crash, I'm probably on the
right track? 

So far, I get a STOP error 0x1000007e (0xC0000005, ...) which is a
'SYSTEM THREAD EXCEPTION NOT HANDLED' error, with the exception being

Xen_version appears to use the two parameter version of the hypercall...
in the linux header this is defined as:

#define _hypercall2(type, name, a1, a2)                         \
({                                                              \
        long __res, __ign1, __ign2;                             \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2)    \
                : "1" ((long)(a1)), "2" ((long)(a2))            \
                : "memory" );                                   \
        (type)__res;                                            \

Now the only x86 assembler I have ever done was at Uni, just over 10
years ago, so I'm guessing the probably is probably my translation to
Microsoft (Intel) compatible inline assembly here:

static __forceinline int
HYPERVISOR_xen_version(int cmd, void *arg)
  long __res;
  __asm {
    push ebp
    mov ebp, esp
    sub esp, 8
    mov eax, cmd
    mov [ebp - 8], eax
    mov eax, arg
    mov [ebp - 4], eax
    call hypercall_stubs + (__HYPERVISOR_xen_version * 32)
    add esp, 8
    pop ebp
    mov [__res], eax
  return __res;

The compiler complains that I'm tinkering with ebp, but I am putting it
back afterwards so I don't see that as a problem.

When I allocate the memory for 'hypercall_stubs', I check the first two
bytes at the (__HYPERVISOR_xen_version * 32) offset before and after the
WRMSR call, and they definitely do change, so I believe the WRMSR call
is correct.

Any suggestions? Writing this email is mostly just therapeutic... so
many times I'll fuss over a problem for ages, finally send a request for
help to a mailing list, and find the problem almost immediately after,
so I'm hoping this will happen here :)



Xen-devel mailing list