• Takuya Yoshikawa's avatar
    KVM: x86: Use macros for x86_emulate_ops to avoid future mistakes · b60d513c
    Takuya Yoshikawa authored
    The return values from x86_emulate_ops are defined
    in kvm_emulate.h as macros X86EMUL_*.
    
    But in emulate.c, we are comparing the return values
    from these ops with 0 to check if they're X86EMUL_CONTINUE
    or not: X86EMUL_CONTINUE is defined as 0 now.
    
    To avoid possible mistakes in the future, this patch
    substitutes "X86EMUL_CONTINUE" for "0" that are being
    compared with the return values from x86_emulate_ops.
    
      We think that there are more places we should use these
      macros, but the meanings of rc values in x86_emulate_insn()
      were not so clear at a glance. If we use proper macros in
      this function, we would be able to follow the flow of each
      emulation more easily and, maybe, more securely.
    Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
    Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    b60d513c
emulate.c 66.6 KB