KVM: x86 emulator: Fix x86_emulate_insn() not to use the variable rc for non-X86EMUL values

This patch makes non-X86EMUL_* family functions not to use
the variable rc.

Be sure that this changes nothing but makes the purpose of
the variable rc clearer.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Takuya Yoshikawa
2010-02-12 16:00:55 +09:00
committed by Avi Kivity
parent 1b30eaa846
commit 0e4176a15f

View File

@@ -2498,9 +2498,9 @@ twobyte_insn:
case 0x21: /* mov from dr to reg */ case 0x21: /* mov from dr to reg */
if (c->modrm_mod != 3) if (c->modrm_mod != 3)
goto cannot_emulate; goto cannot_emulate;
rc = emulator_get_dr(ctxt, c->modrm_reg, &c->regs[c->modrm_rm]); if (emulator_get_dr(ctxt, c->modrm_reg, &c->regs[c->modrm_rm]))
if (rc)
goto cannot_emulate; goto cannot_emulate;
rc = X86EMUL_CONTINUE;
c->dst.type = OP_NONE; /* no writeback */ c->dst.type = OP_NONE; /* no writeback */
break; break;
case 0x22: /* mov reg, cr */ case 0x22: /* mov reg, cr */
@@ -2513,18 +2513,16 @@ twobyte_insn:
case 0x23: /* mov from reg to dr */ case 0x23: /* mov from reg to dr */
if (c->modrm_mod != 3) if (c->modrm_mod != 3)
goto cannot_emulate; goto cannot_emulate;
rc = emulator_set_dr(ctxt, c->modrm_reg, if (emulator_set_dr(ctxt, c->modrm_reg, c->regs[c->modrm_rm]))
c->regs[c->modrm_rm]);
if (rc)
goto cannot_emulate; goto cannot_emulate;
rc = X86EMUL_CONTINUE;
c->dst.type = OP_NONE; /* no writeback */ c->dst.type = OP_NONE; /* no writeback */
break; break;
case 0x30: case 0x30:
/* wrmsr */ /* wrmsr */
msr_data = (u32)c->regs[VCPU_REGS_RAX] msr_data = (u32)c->regs[VCPU_REGS_RAX]
| ((u64)c->regs[VCPU_REGS_RDX] << 32); | ((u64)c->regs[VCPU_REGS_RDX] << 32);
rc = kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data); if (kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data)) {
if (rc) {
kvm_inject_gp(ctxt->vcpu, 0); kvm_inject_gp(ctxt->vcpu, 0);
c->eip = kvm_rip_read(ctxt->vcpu); c->eip = kvm_rip_read(ctxt->vcpu);
} }
@@ -2533,8 +2531,7 @@ twobyte_insn:
break; break;
case 0x32: case 0x32:
/* rdmsr */ /* rdmsr */
rc = kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data); if (kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data)) {
if (rc) {
kvm_inject_gp(ctxt->vcpu, 0); kvm_inject_gp(ctxt->vcpu, 0);
c->eip = kvm_rip_read(ctxt->vcpu); c->eip = kvm_rip_read(ctxt->vcpu);
} else { } else {