Emulate MMX MOVQ
v3 cover Emulate MMX MOVQ
This patchset emulates two instructions:
MOVQ mm, mm/m64
MOVQ mm/m64, mm
Needed by https://bugzilla.kernel.org/show_bug.cgi?id=42779.
Changes from v2:
- s/return rc/goto done/ to get correct return code semantics
- now passes #MF on movq unit test
Changes from v1:
- fix spurious traps propgated into the guest
- delay loading mmx register state until after we're sure it won't trap
Avi Kivity (2):
KVM: x86 emulator: MMX support
KVM: x86 emulator: implement MMX MOVQ (opcodes 0f 6f, 0f 7f)
arch/x86/include/asm/kvm_emulate.h | 4 +- arch/x86/kvm/emulate.c | 111 ++++++++++++++++++++++++++++++++++-- 2 files changed, 109 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.9
PATCH v3 1/2 KVM: x86 emulator: MMX support
General support for the MMX instruction set. Special care is taken to trap pending x87 exceptions so that they are properly reflected to the guest.
--- arch/x86/include/asm/kvm_emulate.h | 4 +- arch/x86/kvm/emulate.c | 103 ++++++++++++++++++++++++++++++++++-- 2 files changed, 102 insertions(+), 5 deletions(-)
arch/x86/include/asm/kvm_emulate.h +3 -1
@@ -200,7 +200,7 @@ typedef u32 __attribute__((vector_size(16))) sse128_t;/* Type, address-of, and value of an instruction's operand. */ struct operand { -enum {OP_REG ,OP_MEM ,OP_IMM ,OP_XMM ,OP_NONE } type; +enum {OP_REG ,OP_MEM ,OP_IMM ,OP_XMM ,OP_MM ,OP_NONE } type;unsigned int bytes;union {unsigned long orig_val;
@@ -213,12 +213,14 @@ struct operand {unsigned seg; } mem;unsigned xmm; +unsigned mm; } addr;union {unsigned long val;u64 val64;char valptr[sizeof (unsigned long ) +2 ];sse128_t vec_val; +u64 mm_val; }; };
arch/x86/kvm/emulate.c +99 -4
159 lines not on this page · raw message
Signature · 1 line
1.7.9
PATCH v3 2/2 KVM: x86 emulator: implement MMX MOVQ (opcodes 0f 6f, 0f 7f)
In reply to Avi KivityNeeded by some framebuffer drivers. See
https://bugzilla.kernel.org/show_bug.cgi?id=42779
--- arch/x86/kvm/emulate.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +7 -1
@@ -2927,6 +2927,12 @@ static int em_movdqu(struct x86_emulate_ctxt *ctxt)return X86EMUL_CONTINUE ; } +static int em_movq (struct x86_emulate_ctxt *ctxt) +{ + ctxt->dst.mm_val = ctxt->src.mm_val; +return X86EMUL_CONTINUE ; +} +static int em_invlpg (struct x86_emulate_ctxt *ctxt) {int rc;
@@ -3466,7 +3472,7 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt) };static struct gprefix pfx_0f_6f_0f_7f = { -N ,N ,N ,I (Sse, em_movdqu), +I (Mmx, em_movq),N ,N ,I (Sse, em_movdqu), };static struct opcode opcode_table[256 ] = {
Signature · 1 line
1.7.9