aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorGuillaume Thouvenin <guillaume.thouvenin@ext.bull.net>2008-05-27 08:49:15 -0400
committerAvi Kivity <avi@qumranet.com>2008-07-20 05:42:28 -0400
commit4257198ae2c36e030a0947fef661c8de973778be (patch)
treea1091af43a2d3e39b7f8597369ba5b7a68b7fd83 /arch/x86/kvm
parent615ac125618dc7b40ecb418e8b353d31ccf0e518 (diff)
KVM: x86 emulator: Add support for mov seg, r (0x8e) instruction
Add support for mov r, sreg (0x8c) instruction. [avi: drop the sreg decoding table in favor of 1:1 encoding] Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Laurent Vivier <laurent.vivier@bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/x86_emulate.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 21d7ff6a8ecd..b049b6bf9a71 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -138,7 +138,8 @@ static u16 opcode_table[256] = {
138 /* 0x88 - 0x8F */ 138 /* 0x88 - 0x8F */
139 ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov, 139 ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov,
140 ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, 140 ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov,
141 0, ModRM | DstReg, 0, Group | Group1A, 141 0, ModRM | DstReg,
142 DstReg | SrcMem | ModRM | Mov, Group | Group1A,
142 /* 0x90 - 0x9F */ 143 /* 0x90 - 0x9F */
143 0, 0, 0, 0, 0, 0, 0, 0, 144 0, 0, 0, 0, 0, 0, 0, 0,
144 0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0, 145 0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0,
@@ -1520,6 +1521,28 @@ special_insn:
1520 case 0x8d: /* lea r16/r32, m */ 1521 case 0x8d: /* lea r16/r32, m */
1521 c->dst.val = c->modrm_ea; 1522 c->dst.val = c->modrm_ea;
1522 break; 1523 break;
1524 case 0x8e: { /* mov seg, r/m16 */
1525 uint16_t sel;
1526 int type_bits;
1527 int err;
1528
1529 sel = c->src.val;
1530 if (c->modrm_reg <= 5) {
1531 type_bits = (c->modrm_reg == 1) ? 9 : 1;
1532 err = kvm_load_segment_descriptor(ctxt->vcpu, sel,
1533 type_bits, c->modrm_reg);
1534 } else {
1535 printk(KERN_INFO "Invalid segreg in modrm byte 0x%02x\n",
1536 c->modrm);
1537 goto cannot_emulate;
1538 }
1539
1540 if (err < 0)
1541 goto cannot_emulate;
1542
1543 c->dst.type = OP_NONE; /* Disable writeback. */
1544 break;
1545 }
1523 case 0x8f: /* pop (sole member of Grp1a) */ 1546 case 0x8f: /* pop (sole member of Grp1a) */
1524 rc = emulate_grp1a(ctxt, ops); 1547 rc = emulate_grp1a(ctxt, ops);
1525 if (rc != 0) 1548 if (rc != 0)