<div dir="ltr"><div style><span style="white-space:pre">// Asm.s</span></div><div>mov<span class="" style="white-space:pre">        </span>$VMCS_HOST_RIP,%rax</div><div>mov<span class="" style="white-space:pre">        </span>$1f,%edx</div>
<div>vmwrite<span class="" style="white-space:pre">        </span>%rdx,%rax</div><div style>It can be inferred from the above code that when vm exit, the followings code will be excuted:</div><div style><div>1:</div><div><span class="" style="white-space:pre">        </span>xchg<span class="" style="white-space:pre">        </span>(%rsp),%rdi</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rax,8*RAX(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rcx,8*RCX(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rdx,8*RDX(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rbx,8*RBX(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rbp,8*RBP(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rsi,8*RSI(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>popq<span class="" style="white-space:pre">        </span>8*RDI(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%cr2,%rax</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%rax,8*CR2(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r8,8*R8(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r9,8*R9(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r10,8*R10(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r11,8*R11(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r12,8*R12(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r13,8*R13(%rdi)</div><div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r14,8*R14(%rdi)</div>
<div><span class="" style="white-space:pre">        </span>mov<span class="" style="white-space:pre">        </span>%r15,8*R15(%rdi)</div><div><span class="" style="white-space:pre">        </span>xor<span class="" style="white-space:pre">        </span>%rax,%rax</div>
<div>2:</div><div><span class="" style="white-space:pre">        </span>pop<span class="" style="white-space:pre">        </span>%r15</div><div><span class="" style="white-space:pre">        </span>pop<span class="" style="white-space:pre">        </span>%r14</div>
<div><span class="" style="white-space:pre">        </span>pop<span class="" style="white-space:pre">        </span>%r13</div><div><span class="" style="white-space:pre">        </span>pop<span class="" style="white-space:pre">        </span>%r12</div>
<div><span class="" style="white-space:pre">        </span>pop<span class="" style="white-space:pre">        </span>%rbx</div><div><span class="" style="white-space:pre">        </span>pop<span class="" style="white-space:pre">        </span>%rbp</div>
<div><span class="" style="white-space:pre">        </span>ret</div><div style>However, the above codes do nothing except that transferring some data. Those code have nothing connected with the function "vt__exit_reason ()" which will handle event.Thank you! </div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/10 Hideki EIRAKU <span dir="ltr"><<a href="mailto:hdk@igel.co.jp" target="_blank">hdk@igel.co.jp</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: ÍõÀûÅó <<a href="mailto:wlpscu@gmail.com">wlpscu@gmail.com</a>><br>
Subject: [BitVisor-devel-en:41] what will bitvisor excute when vm exit?<br>
Date: Fri, 10 May 2013 10:08:25 +0800<br>
<div><div class="h5"><br>
> asm_vmwrite (VMCS_GUEST_RIP, 0xDEADBEEF);<br>
>>From the above sentence, it can be infered that when vm exit, the code at<br>
> the address 0xDEADBEEF will excute. But I does not know what function it<br>
> will excute? Thank you!<br>
<br>
</div></div>The VMCS_GUEST_RIP is overwritten in the copy_bootsector() function.<br>
The address 0xDEADBEEF is for debugging use only. The address cannot<br>
be executed in real-address mode. So if the VM stopped at the<br>
address, there is an initialization problem.<br>
<br>
On VM exit, CPU modifies the program counter to a value in<br>
VMCS_HOST_RIP (not VMCS_GUEST_RIP). The VMCS_HOST_RIP is overwritten<br>
before executing vmlaunch or vmresume in functions in the file<br>
core/asm.s.<br>
<br>
0xDEADBEEF is one of hexspeak values.<br>
See <a href="http://en.wikipedia.org/wiki/Hexspeak" target="_blank">http://en.wikipedia.org/wiki/Hexspeak</a> for more details.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Hideki EIRAKU <<a href="mailto:hdk@igel.co.jp">hdk@igel.co.jp</a>><br>
</font></span></blockquote></div><br></div>