|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Hypercall Inquiries
On 11/05/17 15:22, Rapidash wrote:
> Greetings,
> My co-worker and I are looking into Xen Hypervisor. By any chance, do
> you or any of your colleagues have technical material/ papers/
> presentations detailing how the hypercall interacts with the hypervisor?
xen/include/public/arch-x86/xen-x86_{32,64}.h document the ABI.
There are some books on Xen, but there isn't a written technical
specification (as far as I am aware).
>
> Thank you in advance for any assistance,
> - Rapidash
>
>
> Some specific questions:
> - If the memory of the VM is stored on non-congruent sections of the
> host's machine memory, how does the hypercall handler check whether a
> passed in pointer parameter falls within these VM claimed sections of
> memory?
You look like you are considering PV guests?
If so, realise that PV guests running under Xen are just like userspace
processes running under an native kernel. There is a shared virtual
address space, and the system call interface uses plain pointers.
> - Since the hypercalls are limited in number compared to syscalls, is
> there ever an instance where the domain will require a syscall that
> the hypercall does not cover?
I don't understand the what you mean. "hypercalls" are just system
calls from the guest kernel to Xen. They are entirely orthogonal to the
guests userspace issuing system calls to its kernel.
>
> Also, we have been looking at the Xen hypercall source code to try and
> figure out the mechanics there. In file "hypercall-x86_64.h" there is
> the following code segment we are attempting to decipher (from it, we
> can figure out the preceding functions):
>
> #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
> ({ \
> long __res, __ign1, __ign2, __ign3; \
> asm volatile ( \
> "movq %7,%%r10; movq %8,%%r8; " \
> "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
> : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
> "=d" (__ign3) \
> : "1" ((long)(a1)), "2" ((long)(a2)), \
> "3" ((long)(a3)), "g" ((long)(a4)), \
> "g" ((long)(a5)) \
> : "memory", "r10", "r8" ); \
> (type)__res; \
> })
This is a rather poor piece of code, but I am afraid that my best advice
here is to read the GCC documentation on how the asm() statement. None
of these questions are xen-specific, but the chances are good that you
wont understand my answers if you don't understand how extended assembly
works.
>
> - The first line within the asm volatile section, are the contents of
> registers being saved to memory? If so, where?
No. AT&T syntax reads left to right, so the destination operands are on
the right hand side. In this case, the %r10 and %r8 registers.
> - In the third and fourth lines within the same section, are values
> from __res being placed into the "a" register, or are the values
> within the "a" register being stored in the variable __res for use later?
"=a" is an output, meaning that %rax gets stored into __res.
> - Does the "1", "2", "3", "g", "g" correspond to the ebx, ecx, edx,
> esi, and edi registers? Or are they a different set?
The numbers match up to the output operands, so are %rdi, %rsi, %rdx in
that order.
The g constraint means any general purpose register.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |