[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-users] use hypercall in kernel module
Hello, On 25/05/16 04:47, Big Strong wrote: While we can use privcmd_call in hypercall.h to issue the hypercall in kernel module, it is unclear how to set the arguments to adapt it to registers. static inline long privcmd_call(unsigned call, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { __HYPERCALL_DECLS; __HYPERCALL_5ARG(a1, a2, a3, a4, a5); asm volatile("call *%[call]" : __HYPERCALL_5PARAM : [call] "a" (&*hypercall_page*[call]) : __HYPERCALL_CLOBBER5); return (long)__res; } Take HYPERCALL_hvm_op as an example, the arguments are op and arg, when the op is HVMOP_altp2m, we need to convert arg to xen_hvm_altp2m_op. Now what if I want to directly assign a xen_hvm_altp2m_op as the argument a2 and HVMOP_altp2m as a1 and __HYPERVISOR_hvm_op as call? How can a2 be assigned as it is defined as a uint64 while xen_hvm_altp2m_op is a structure? Should I use (xen_hvm_altp2m_op *) pointer as a2? Or is there any example on how to use hypercall in LKM (linux loadable kernel module)? I don't know how to convert the arguments to registers. Give a look to arch/x86/asm/xen/hypercall.h to see how hypercalls are implemented for the kernel. Regards, -- Julien Grall _______________________________________________ Xen-users mailing list Xen-users@xxxxxxxxxxxxx http://lists.xen.org/xen-users
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |