All of lore.kernel.org
 help / color / mirror / Atom feed
* Passing pointers to hypercalls
@ 2014-11-09 19:16 Amaro, Emmanuel
  2014-11-09 19:27 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Amaro, Emmanuel @ 2014-11-09 19:16 UTC (permalink / raw)
  To: xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 955 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 4408 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-09 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-09 19:16 Passing pointers to hypercalls Amaro, Emmanuel
2014-11-09 19:27 ` Andrew Cooper
2014-11-09 19:50   ` Amaro, Emmanuel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.