On 28/07/21 13:37, Lara Lazier wrote:
+    uint32_t int_ctl = x86_ldl_phys(cs,
+                       env->vm_vmcb + offsetof(struct vmcb, control.int_ctl));
+    if (virtual_gif_enabled(env, int_ctl) && likely(env->hflags & 
HF_GUEST_MASK)) {
+        x86_stl_phys(cs, env->vm_vmcb + offsetof(struct vmcb, control.int_ctl),
+                        int_ctl & ~V_GIF_MASK);
+    } else {

Sorry for the double reply. env->vm_vmcb is not guaranteed to be valid if not in guest mode, so there are two possibilities.

1) Keep the HF_GUEST_MASK check directly in the helpers, but do it before x86_ldl_phys

2) Move x86_ldl_phys to virtual_gif_enabled, with a prototype like

bool virtual_gif_enabled(CPUX86State *env, uint32_t *int_ctl)

i.e. returning int_ctl from virtual_gif_enabled via pass-by-reference.

Thanks,

Paolo


Reply via email to