Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: >On 05/03/20 03:35, linmiaohe wrote: >> (X86_EFLAGS_IOPL | X86_EFLAGS_VM) indicates the eflag bits that can >> not be owned by realmode guest, i.e. ~RMODE_GUEST_OWNED_EFLAGS_BITS. > >... but ~RMODE_GUEST_OWNED_EFLAGS_BITS is the bits that are owned by the host; they could be 0 or 1 and that's why the code was using X86_EFLAGS_IOPL | X86_EFLAGS_VM. > >I understand where ~RMODE_GUEST_OWNED_EFLAGS_BITS is better than X86_EFLAGS_IOPL | X86_EFLAGS_VM, but I cannot think of a way to express it that is the best of both worlds. > Define a macro RMODE_HOST_OWNED_EFLAGS_BITS for (X86_EFLAGS_IOPL | X86_EFLAGS_VM) as suggested by Vitaly seems a good way to fix this ? Thanks.