Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2013 at 6:03 PM, Jan Kiszka <jan.kiszka@xxxxxx> wrote:
> On 2013-07-24 11:56, Arthur Chunqi Li wrote:
>> So what about this one. I merged all the exit reason to "ret" and
>> remove the flag detection after vmlaunch/vmresume (because I think
>> this detection is useless). Currently we support only one guest, so
>> variant "launched" is located in vmx_run(). If we want to support
>> multiple guest, we could move it to some structures (e.g.
>> environment_ctxt). Now I just put it here.
>>
>> static int vmx_run()
>> {
>>     u32 ret = 0;
>>     bool launched = 0;
>>
>>     asm volatile(
>>         "mov %%rsp, %%rsi\n\t"
>>         "mov %2, %%edi\n\t"
>>         "call vmcs_write\n\t"
>>
>>         "0: "
>>         LOAD_GPR_C
>>         "cmp $0, %1\n\t"
>>         "jne 1f\n\t"
>>         "vmlaunch\n\t"
>>         SAVE_GPR_C
>>         /* vmlaunch error, return VMX_TEST_LAUNCH_ERR */
>>         "mov %3, %0\n\t"
>>         "jmp 2f\n\t"
>>         "1: "
>>         "vmresume\n\t"
>>         SAVE_GPR_C
>>         /* vmresume error, return VMX_TEST_RESUME_ERR */
>>         "mov %4, %0\n\t"
>>         "jmp 2f\n\t"
>
> Where do you store the flags now? You may want to differentiate / test
> if ZF of CF is set.
I store the flags as a global variant. You mean I need to detect ZF/CF
after vmlaunch/vmresume?

Arthur
>
> Jan
>
>>         "vmx_return:\n\t"
>>         SAVE_GPR_C
>>         "call exit_handler\n\t"
>>         /* set launched = 1 */
>>         "mov $0x1, %1\n\t"
>>         "cmp %5, %%eax\n\t"
>>         "je 0b\n\t"
>>         "mov %%eax, %0\n\t"
>>         "2: "
>>         : "=r"(ret), "=r"(launched)
>>         : "i"(HOST_RSP), "i"(VMX_TEST_LAUNCH_ERR),
>>           "i"(VMX_TEST_RESUME_ERR), "i"(VMX_TEST_RESUME)
>>         : "rax", "rbx", "rdi", "rsi",
>>           "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
>>           "memory", "cc"
>>     );
>>     switch (ret) {
>>     case VMX_TEST_VMEXIT:
>>         return 0;
>>     case VMX_TEST_LAUNCH_ERR:
>>         printf("%s : vmlaunch failed.\n", __func__);
>>         break;
>>     case VMX_TEST_RESUME_ERR:
>>         printf("%s : vmresume failed.\n", __func__);
>>         break;
>>     default:
>>         printf("%s : unhandled ret from exit_handler, ret=%d.\n",
>> __func__, ret);
>>         break;
>>     }
>>     return 1;
>> }
>>
>
>



-- 
Arthur Chunqi Li
Department of Computer Science
School of EECS
Peking University
Beijing, China
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux