KVM: x86: Use macros for x86_emulate_ops to avoid future mistakes
commitb60d513c32e2ddc8b3e9e1465b94913d44d19810
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Wed, 20 Jan 2010 07:47:21 +0000 (20 16:47 +0900)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 1 Mar 2010 15:36:01 +0000 (1 12:36 -0300)
treed0b42d5ff9e331107ada9b7b00f08778341953bd
parent647492047763c3ee8fe51ecf9a04f39040aa495b
KVM: x86: Use macros for x86_emulate_ops to avoid future mistakes

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: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/emulate.c