|
From: | Paolo Bonzini |
Subject: | Re: [PATCH v2] target/i386: Added VGIF feature |
Date: | Thu, 29 Jul 2021 10:01:22 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |