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

[Xen-devel] Passing pointers to hypercalls


  • To: "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
  • From: "Amaro, Emmanuel" <amaro@xxxxxxxxxx>
  • Date: Sun, 9 Nov 2014 19:16:22 +0000
  • Accept-language: en-US
  • Delivery-date: Sun, 09 Nov 2014 19:23:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: AQHP/FGmdYH9wvi+VUqxQYzkRUaDKg==
  • Thread-topic: Passing pointers to hypercalls

Hello,

I am trying to pass a pointer to an hyper call in the simplest possible way, set itâs value, an return it to the guest.

I have tried 2 different ways:
- Directly with simple pointers (I read somewhere this would work on x86), but the pointer address is set to 0x0000deadbeef, so dereferencing it causes a panic.
- With XEN_GUEST_HANDLE:
long do_dummy(XEN_GUEST_HANDLE(uint64_t) ptr)
{
    uint64_t tmp = 1;

    if (copy_to_guest(ptr, &tmp, 1) != 0)
        return 2;

    return 0;
}

But in this case copy_to_guest() does not return 0, so this fails as well. I call the hyper call from this Linux system call:

asmlinkage long sys_dummy(void)
{
    uint64_t p = 0;
    int rc = 0;
    rc = HYPERVISOR_dummy(&p);

    if (rc != 0)
        printk("ERROR, hypercall returned: %d\n", rc);

    return 0;
}

I am sure I am missing something super easy, but I canât see what.

Thank you for your help,
Emmanuel
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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