diff options
author | Sheng Yang <sheng.yang@intel.com> | 2007-11-15 01:52:28 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:03 -0500 |
commit | a7e6c88a78b7c3d67491bf90b2b95e66437dbdb6 (patch) | |
tree | ca16a7c1c0d18d57b4a04d355d8aea8ade6536cf /drivers | |
parent | f8c16bbaa9e14b309ffcf29cac0ea377a35b0dd2 (diff) |
KVM: x86 emulator: modify 'lods', and 'stos' not to depend on CR2
The current 'lods' and 'stos' is depending on incoming CR2 rather than decode
memory address from registers.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/x86_emulate.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index e6979475bee7..8e2162fc6f70 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -1528,7 +1528,9 @@ special_insn: | |||
1528 | case 0xaa ... 0xab: /* stos */ | 1528 | case 0xaa ... 0xab: /* stos */ |
1529 | c->dst.type = OP_MEM; | 1529 | c->dst.type = OP_MEM; |
1530 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; | 1530 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; |
1531 | c->dst.ptr = (unsigned long *)cr2; | 1531 | c->dst.ptr = (unsigned long *)register_address( |
1532 | ctxt->es_base, | ||
1533 | c->regs[VCPU_REGS_RDI]); | ||
1532 | c->dst.val = c->regs[VCPU_REGS_RAX]; | 1534 | c->dst.val = c->regs[VCPU_REGS_RAX]; |
1533 | register_address_increment(c->regs[VCPU_REGS_RDI], | 1535 | register_address_increment(c->regs[VCPU_REGS_RDI], |
1534 | (ctxt->eflags & EFLG_DF) ? -c->dst.bytes | 1536 | (ctxt->eflags & EFLG_DF) ? -c->dst.bytes |
@@ -1538,9 +1540,13 @@ special_insn: | |||
1538 | c->dst.type = OP_REG; | 1540 | c->dst.type = OP_REG; |
1539 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; | 1541 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; |
1540 | c->dst.ptr = (unsigned long *)&c->regs[VCPU_REGS_RAX]; | 1542 | c->dst.ptr = (unsigned long *)&c->regs[VCPU_REGS_RAX]; |
1541 | if ((rc = ops->read_emulated(cr2, &c->dst.val, | 1543 | if ((rc = ops->read_emulated(register_address( |
1542 | c->dst.bytes, | 1544 | c->override_base ? *c->override_base : |
1543 | ctxt->vcpu)) != 0) | 1545 | ctxt->ds_base, |
1546 | c->regs[VCPU_REGS_RSI]), | ||
1547 | &c->dst.val, | ||
1548 | c->dst.bytes, | ||
1549 | ctxt->vcpu)) != 0) | ||
1544 | goto done; | 1550 | goto done; |
1545 | register_address_increment(c->regs[VCPU_REGS_RSI], | 1551 | register_address_increment(c->regs[VCPU_REGS_RSI], |
1546 | (ctxt->eflags & EFLG_DF) ? -c->dst.bytes | 1552 | (ctxt->eflags & EFLG_DF) ? -c->dst.bytes |