KVM: x86 emulator: make (get|set)_dr() callback return error if it fails

Make (get|set)_dr() callback return error if it fails instead of
injecting exception behind emulator's back.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Gleb Natapov
2010-04-28 19:15:32 +03:00
committed by Avi Kivity
parent 0f12244fe7
commit 338dbc9781
2 changed files with 45 additions and 29 deletions

View File

@@ -3151,9 +3151,14 @@ twobyte_insn:
goto done;
}
ops->set_dr(c->modrm_reg,c->regs[c->modrm_rm] &
((ctxt->mode == X86EMUL_MODE_PROT64) ? ~0ULL : ~0U),
ctxt->vcpu);
if (ops->set_dr(c->modrm_reg, c->regs[c->modrm_rm] &
((ctxt->mode == X86EMUL_MODE_PROT64) ?
~0ULL : ~0U), ctxt->vcpu) < 0) {
/* #UD condition is already handled by the code above */
kvm_inject_gp(ctxt->vcpu, 0);
goto done;
}
c->dst.type = OP_NONE; /* no writeback */
break;
case 0x30: