Il 24/07/2013 08:46, Arthur Chunqi Li ha scritto: > On Wed, Jul 24, 2013 at 2:40 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: >> Il 24/07/2013 08:11, Arthur Chunqi Li ha scritto: >>> >>> static int vmx_run() >>> { >>> u32 eax; >>> bool ret; >>> >>> vmcs_write(HOST_RSP, get_rsp()); >>> ret = vmlaunch(); >> >> The compiler can still change rsp between here... >> >>> while (!ret) { >>> asm volatile( >>> "vmx_return:\n\t" >> >> ... and here. >> >> If you want to write it in C, the only thing that can be after >> vmlaunch/vmresume is "exit()". Else it has to be asm. > Actually, you mean we need to write all the codes in asm to avoid > changing to rsp, right?
Not necessarily all the code. It is also ok to use setjmp/longjmp with a small asm trampoline, because this method won't care about the exact rsp values that are used. But if you want to do as Gleb said, and put vmx_return just after vmlaunch, it has to be all asm as in KVM's arch/x86/kvm/vmx.c. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html