On 2013-07-24 12:16, Arthur Chunqi Li wrote: > 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? Yes - if you want to check correct emulation of those instructions completely. Jan
Attachment:
signature.asc
Description: OpenPGP digital signature