From 7466b7472743a42ba139723d3018fc55476ce40d Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Date: Mon, 9 Apr 2012 18:40:00 +0300
Subject: [PATCH 2/2] KVM: x86: emulate movdqa
BugLink: http://bugs.launchpad.net/bugs/1330177
An Ubuntu 9.10 Karmic Koala guest is unable to boot or install due to
missing movdqa emulation:
kvm_exit: reason EXCEPTION_NMI rip 0x7fef3e025a7b info 7fef3e799000 80000b0e
kvm_page_fault: address 7fef3e799000 error_code f
kvm_emulate_insn: 0:7fef3e025a7b: 66 0f 7f 07 (prot64)
movdqa %xmm0,(%rdi)
[avi: mark it explicitly aligned]
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
(cherry picked from commit 49597d8116ad70aabb598e606b218ddd9315b0af)
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Anton Nayshtut <anton@swortex.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
arch/x86/kvm/emulate.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
@@ -2703,7 +2703,7 @@ static int em_rdtsc(struct x86_emulate_ctxt *ctxt)
static int em_mov(struct x86_emulate_ctxt *ctxt)
{
- ctxt->dst.val = ctxt->src.val;
+ memcpy(ctxt->dst.valptr, ctxt->src.valptr, ctxt->op_bytes);
return X86EMUL_CONTINUE;
}
@@ -2731,12 +2731,6 @@ static int em_mov_sreg_rm(struct x86_emulate_ctxt *ctxt)
return load_segment_descriptor(ctxt, sel, ctxt->modrm_reg);
}
-static int em_movdqu(struct x86_emulate_ctxt *ctxt)
-{
- memcpy(&ctxt->dst.vec_val, &ctxt->src.vec_val, ctxt->op_bytes);
- return X86EMUL_CONTINUE;
-}
-
static int em_invlpg(struct x86_emulate_ctxt *ctxt)
{
int rc;
@@ -3190,7 +3184,7 @@ static struct opcode group11[] = {
};
static struct gprefix pfx_0f_6f_0f_7f = {
- N, N, N, I(Sse | Unaligned, em_movdqu),
+ N, I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov),
};
static struct opcode opcode_table[256] = {
--
1.9.1