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

Re: [Xen-users] use hypercall in kernel module

I'm not sure if you mean  xen\include\asm-x86\hypercall.h or extras\mini-os\include\x86\x86_32\hypercall-x86_32.h, I guess it is the former one. 
Take HYPERVISOR_mmu_update as an example, the corresponding function in hypercall.h is:

    XEN_GUEST_HANDLE_PARAM(mmu_update_t) ureqs,
    unsigned int count,
    XEN_GUEST_HANDLE_PARAM(uint) pdone,
    unsigned int foreigndom);

While in hypercall-x86_32.h, it is defined as:

static inline int
mmu_update_t *req, int count, int *success_count, domid_t domid)
return _hypercall4(int, mmu_update, req, count, success_count, domid);

Can I use these functions directly in domU kernel?  When using libxc/privcmd in domU userland, the arguments are converted into a suitable form using HYPERCALL_BUFFER_AS_ARG(arg), how should the arguments be conveyed when using from domU kernel?

2016-05-25 19:21 GMT+08:00 Julien Grall <julien.grall@xxxxxxx>:
On 25/05/16 12:14, Big Strong wrote:
        Give a look to arch/x86/asm/xen/hypercall.h to see how
        hypercalls are implemented for the kernel.


    Julien Grall

Thanks for the suggestion. But what I pasted is right from hypercall.h.
What I'm not understand is how can I directly assign arguments to the
registers a1-a5. As I don't want to use privcmd to issue the hypercall,
which is a user-level interface. Can you show me one simple example on
how to do that?

There is multiple example on how to implement hypercalls for the kernel within this file (e.g HYPERVISOR_mmu_update).

You may have to implement yours if there is no helpers for you hypercall.


Julien Grall

Xen-users mailing list



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