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?

Arthur
>
> Paolo
>
>>             SAVE_GPR
>>         );
>>         eax = exit_handler();
>>         switch (eax) {
>>         case VMX_TEST_VMEXIT:
>>             return 0;
>>         case VMX_TEST_RESUME:
>>             break;
>>         default:
>>             printf("%s : unhandled ret from exit_handler.\n", __func__);
>>             return 1;
>>         }
>>         ret = vmresume();
>>     }
>>     printf("%s : vmenter failed.\n", __func__);
>>     return 1;
>> }
>
--
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

Reply via email to