aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/x86_emulate.c
diff options
context:
space:
mode:
authorZhang Xiantao <xiantao.zhang@intel.com>2007-12-13 10:50:52 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:58:09 -0500
commitad312c7c79f781c822e37effe41307503a2bb85b (patch)
treed979bfb70e76ada58b79b456c61a0507a8f0847d /drivers/kvm/x86_emulate.c
parent682c59a3f3f211ed555b17144f2d82eb8286a1db (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.c24
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)
769 /* Shadow copy of register state. Committed on successful emulation. */ 769 /* Shadow copy of register state. Committed on successful emulation. */
770 770
771 memset(c, 0, sizeof(struct decode_cache)); 771 memset(c, 0, sizeof(struct decode_cache));
772 c->eip = ctxt->vcpu->rip; 772 c->eip = ctxt->vcpu->arch.rip;
773 memcpy(c->regs, ctxt->vcpu->regs, sizeof c->regs); 773 memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
774 774
775 switch (mode) { 775 switch (mode) {
776 case X86EMUL_MODE_REAL: 776 case X86EMUL_MODE_REAL:
@@ -1226,7 +1226,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
1226 * modify them. 1226 * modify them.
1227 */ 1227 */
1228 1228
1229 memcpy(c->regs, ctxt->vcpu->regs, sizeof c->regs); 1229 memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
1230 saved_eip = c->eip; 1230 saved_eip = c->eip;
1231 1231
1232 if (((c->d & ModRM) && (c->modrm_mod != 3)) || (c->d & MemAbs)) 1232 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)
1235 if (c->rep_prefix && (c->d & String)) { 1235 if (c->rep_prefix && (c->d & String)) {
1236 /* All REP prefixes have the same first termination condition */ 1236 /* All REP prefixes have the same first termination condition */
1237 if (c->regs[VCPU_REGS_RCX] == 0) { 1237 if (c->regs[VCPU_REGS_RCX] == 0) {
1238 ctxt->vcpu->rip = c->eip; 1238 ctxt->vcpu->arch.rip = c->eip;
1239 goto done; 1239 goto done;
1240 } 1240 }
1241 /* The second termination condition only applies for REPE 1241 /* 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)
1249 (c->b == 0xae) || (c->b == 0xaf)) { 1249 (c->b == 0xae) || (c->b == 0xaf)) {
1250 if ((c->rep_prefix == REPE_PREFIX) && 1250 if ((c->rep_prefix == REPE_PREFIX) &&
1251 ((ctxt->eflags & EFLG_ZF) == 0)) { 1251 ((ctxt->eflags & EFLG_ZF) == 0)) {
1252 ctxt->vcpu->rip = c->eip; 1252 ctxt->vcpu->arch.rip = c->eip;
1253 goto done; 1253 goto done;
1254 } 1254 }
1255 if ((c->rep_prefix == REPNE_PREFIX) && 1255 if ((c->rep_prefix == REPNE_PREFIX) &&
1256 ((ctxt->eflags & EFLG_ZF) == EFLG_ZF)) { 1256 ((ctxt->eflags & EFLG_ZF) == EFLG_ZF)) {
1257 ctxt->vcpu->rip = c->eip; 1257 ctxt->vcpu->arch.rip = c->eip;
1258 goto done; 1258 goto done;
1259 } 1259 }
1260 } 1260 }
1261 c->regs[VCPU_REGS_RCX]--; 1261 c->regs[VCPU_REGS_RCX]--;
1262 c->eip = ctxt->vcpu->rip; 1262 c->eip = ctxt->vcpu->arch.rip;
1263 } 1263 }
1264 1264
1265 if (c->src.type == OP_MEM) { 1265 if (c->src.type == OP_MEM) {
@@ -1628,7 +1628,7 @@ special_insn:
1628 c->dst.type = OP_NONE; /* Disable writeback. */ 1628 c->dst.type = OP_NONE; /* Disable writeback. */
1629 break; 1629 break;
1630 case 0xf4: /* hlt */ 1630 case 0xf4: /* hlt */
1631 ctxt->vcpu->halt_request = 1; 1631 ctxt->vcpu->arch.halt_request = 1;
1632 goto done; 1632 goto done;
1633 case 0xf5: /* cmc */ 1633 case 0xf5: /* cmc */
1634 /* complement carry flag from eflags reg */ 1634 /* complement carry flag from eflags reg */
@@ -1665,8 +1665,8 @@ writeback:
1665 goto done; 1665 goto done;
1666 1666
1667 /* Commit shadow register state. */ 1667 /* Commit shadow register state. */
1668 memcpy(ctxt->vcpu->regs, c->regs, sizeof c->regs); 1668 memcpy(ctxt->vcpu->arch.regs, c->regs, sizeof c->regs);
1669 ctxt->vcpu->rip = c->eip; 1669 ctxt->vcpu->arch.rip = c->eip;
1670 1670
1671done: 1671done:
1672 if (rc == X86EMUL_UNHANDLEABLE) { 1672 if (rc == X86EMUL_UNHANDLEABLE) {
@@ -1783,7 +1783,7 @@ twobyte_insn:
1783 rc = kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data); 1783 rc = kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data);
1784 if (rc) { 1784 if (rc) {
1785 kvm_inject_gp(ctxt->vcpu, 0); 1785 kvm_inject_gp(ctxt->vcpu, 0);
1786 c->eip = ctxt->vcpu->rip; 1786 c->eip = ctxt->vcpu->arch.rip;
1787 } 1787 }
1788 rc = X86EMUL_CONTINUE; 1788 rc = X86EMUL_CONTINUE;
1789 c->dst.type = OP_NONE; 1789 c->dst.type = OP_NONE;
@@ -1793,7 +1793,7 @@ twobyte_insn:
1793 rc = kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data); 1793 rc = kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data);
1794 if (rc) { 1794 if (rc) {
1795 kvm_inject_gp(ctxt->vcpu, 0); 1795 kvm_inject_gp(ctxt->vcpu, 0);
1796 c->eip = ctxt->vcpu->rip; 1796 c->eip = ctxt->vcpu->arch.rip;
1797 } else { 1797 } else {
1798 c->regs[VCPU_REGS_RAX] = (u32)msr_data; 1798 c->regs[VCPU_REGS_RAX] = (u32)msr_data;
1799 c->regs[VCPU_REGS_RDX] = msr_data >> 32; 1799 c->regs[VCPU_REGS_RDX] = msr_data >> 32;