<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Dear all,</div><div>
<p style="margin-bottom: 0in; line-height: 100%;">I startup PMU In bitvisor to monitor the guest. I want to make this
process transparent. Specifically, I hope only bitvisor deals with
the NMIs, and the gust does not invoke its NMI handler when resumed. I
use the following two methods but both failed (the computer is freezed!). Could some one help me, or give a suggestion?</p><div><br></div>
<p style="margin-bottom: 0in; line-height: 100%;">
----------------------Method 1----------------------</p>
<p style="margin-bottom: 0in; line-height: 100%;">
vt_nmi_has_come (void)</p>
<p style="margin-bottom: 0in; line-height: 100%;">
{</p>
<p style="margin-bottom: 0in; line-height: 100%;">
    asm_vmread (VMCS_GUEST_INTERRUPTIBILITY_STATE, &is);</p>
<p style="margin-bottom: 0in; line-height: 100%;">
-    if (is &
VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCKING_BY_NMI_BIT)</p>
<p style="margin-bottom: 0in; line-height: 100%;">
-        return;</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+   if (is &
VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCKING_BY_NMI_BIT) {</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+       if (perf_ovflow_status & 1 == 1)</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+               asm(¡°iret¡±);</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+       else</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+               return;</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+    }</p>
<p style="margin-bottom: 0in; line-height: 100%;">
----------------------end------------------------------</p>
<p style="margin-bottom: 0in; line-height: 100%;">
<br>

</p>
<p style="margin-bottom: 0in; line-height: 100%;">
----------------------Method 2----------------------</p>
<p style="margin-bottom: 0in; line-height: 100%;">
vt_nmi_has_come (void)</p>
<p style="margin-bottom: 0in; line-height: 100%;">
{</p>
<p style="margin-bottom: 0in; line-height: 100%;">
    asm_vmread (VMCS_GUEST_INTERRUPTIBILITY_STATE, &is);</p>
<p style="margin-bottom: 0in; line-height: 100%;">
-    if (is &
VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCKING_BY_NMI_BIT)</p>
<p style="margin-bottom: 0in; line-height: 100%;">
-        return;</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+   if (is &
VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCKING_BY_NMI_BIT) {</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+       if (perf_ovflow_status & 1 == 1)</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+               clear_blocking_by_nmi (void);</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+       else</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+               return;</p>
<p style="margin-bottom: 0in; line-height: 100%;">
+    }</p>
<p style="margin-bottom: 0in; line-height: 100%;">
----------------------end------------------------------</p>
<p style="margin-bottom: 0in; line-height: 100%;">
<br>

</p>
<p style="margin-bottom: 0in; line-height: 100%;"><br></p>
<p style="margin-bottom: 0in; line-height: 100%;">
Thanks!</p></div></div><br><br><span title="neteasefooter"><p> </p></span>