Thread (1 message) 1 message, 1 author, 2007-06-26

Re: [PATCH 1/5] KVM paravirt_ops core infrastructure

From: Jun Koi <hidden>
Date: 2007-06-26 08:45:03
Also in: kvm

On 6/26/07, Dor Laor [off-list ref] wrote:
...
+static __init struct kvm_paravirt_state *paravirt_alloc_state(void)
+{
+       struct kvm_paravirt_state *state;
+
+       state = (void *)get_zeroed_page(GFP_KERNEL);
+       if (!state)
+               goto err;
+
+       state->vmca = (void *)get_zeroed_page(GFP_KERNEL);
+       if (!state->vmca)
+               goto err;
+
+       /* FIXME: what do I need for this to be executable on 64 bit? */
+       state->hypercall = (void *)get_zeroed_page(GFP_KERNEL);

Why do you alloc a page for the hypercall instead of using Ingo's code
below? This way it can work for 64 bit too.

Ingo's code:
/*
 * This is the vm-syscall address - to be patched by the host to
 * VMCALL (Intel) or VMMCALL (AMD), depending on the CPU model:
 */
asm (
        "       .globl hypercall_addr                   \n"
        "       .align 4                                \n"
        "       hypercall_addr:                         \n"
        "               movl $-38, %eax                 \n"
        "               ret                             \n"
);
The assembly code "movl $-38, %eax; \nret" is only a "reserved place",
which is later overwritten by hypercall address from the host, isnt
it?

If so, why dont we simply put 4 NOPs there?

Thanks,
Jun

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help