diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-12-13 23:50:52 +0800 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 17:58:09 +0200 |
commit | ad312c7c79f781c822e37effe41307503a2bb85b (patch) | |
tree | d979bfb70e76ada58b79b456c61a0507a8f0847d /drivers/kvm/x86_emulate.c | |
parent | 682c59a3f3f211ed555b17144f2d82eb8286a1db (diff) |
KVM: Portability: Introduce kvm_vcpu_arch
Move all the architecture-specific fields in kvm_vcpu into a new struct
kvm_vcpu_arch.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.c')
-rw-r--r-- | drivers/kvm/x86_emulate.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 0a6ab06fde0..50b133f6874 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c @@ -769,8 +769,8 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) /* Shadow copy of register state. Committed on successful emulation. */ memset(c, 0, sizeof(struct decode_cache)); - c->eip = ctxt->vcpu->rip; - memcpy(c->regs, ctxt->vcpu->regs, sizeof c->regs); + c->eip = ctxt->vcpu->arch.rip; + memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs); switch (mode) { case X86EMUL_MODE_REAL: @@ -1226,7 +1226,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) * modify them. */ - memcpy(c->regs, ctxt->vcpu->regs, sizeof c->regs); + memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs); saved_eip = c->eip; if (((c->d & ModRM) && (c->modrm_mod != 3)) || (c->d & MemAbs)) @@ -1235,7 +1235,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) if (c->rep_prefix && (c->d & String)) { /* All REP prefixes have the same first termination condition */ if (c->regs[VCPU_REGS_RCX] == 0) { - ctxt->vcpu->rip = c->eip; + ctxt->vcpu->arch.rip = c->eip; goto done; } /* The second termination condition only applies for REPE @@ -1249,17 +1249,17 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) (c->b == 0xae) || (c->b == 0xaf)) { if ((c->rep_prefix == REPE_PREFIX) && ((ctxt->eflags & EFLG_ZF) == 0)) { - ctxt->vcpu->rip = c->eip; + ctxt->vcpu->arch.rip = c->eip; goto done; } if ((c->rep_prefix == REPNE_PREFIX) && ((ctxt->eflags & EFLG_ZF) == EFLG_ZF)) { - ctxt->vcpu->rip = c->eip; + ctxt->vcpu->arch.rip = c->eip; goto done; } } c->regs[VCPU_REGS_RCX]--; - c->eip = ctxt->vcpu->rip; + c->eip = ctxt->vcpu->arch.rip; } if (c->src.type == OP_MEM) { @@ -1628,7 +1628,7 @@ special_insn: c->dst.type = OP_NONE; /* Disable writeback. */ break; case 0xf4: /* hlt */ - ctxt->vcpu->halt_request = 1; + ctxt->vcpu->arch.halt_request = 1; goto done; case 0xf5: /* cmc */ /* complement carry flag from eflags reg */ @@ -1665,8 +1665,8 @@ writeback: goto done; /* Commit shadow register state. */ - memcpy(ctxt->vcpu->regs, c->regs, sizeof c->regs); - ctxt->vcpu->rip = c->eip; + memcpy(ctxt->vcpu->arch.regs, c->regs, sizeof c->regs); + ctxt->vcpu->arch.rip = c->eip; done: if (rc == X86EMUL_UNHANDLEABLE) { @@ -1783,7 +1783,7 @@ twobyte_insn: rc = kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data); if (rc) { kvm_inject_gp(ctxt->vcpu, 0); - c->eip = ctxt->vcpu->rip; + c->eip = ctxt->vcpu->arch.rip; } rc = X86EMUL_CONTINUE; c->dst.type = OP_NONE; @@ -1793,7 +1793,7 @@ twobyte_insn: rc = kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data); if (rc) { kvm_inject_gp(ctxt->vcpu, 0); - c->eip = ctxt->vcpu->rip; + c->eip = ctxt->vcpu->arch.rip; } else { c->regs[VCPU_REGS_RAX] = (u32)msr_data; c->regs[VCPU_REGS_RDX] = msr_data >> 32; |