diff options
author | Gleb Natapov <gleb@redhat.com> | 2010-04-28 19:15:32 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 10:35:32 +0300 |
commit | 338dbc9781eb5acd0b12809d95d4006135f29767 (patch) | |
tree | ceb9fc9b2eb7e52c9352f094436590c82852d71f /arch/x86/kvm/emulate.c | |
parent | 0f12244fe70e8a94a491f6cd7ed70a352ab6c26c (diff) |
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>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 061f7d37c9f..d5979ecc252 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -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: |