diff options
author | Sheng Yang <sheng.yang@intel.com> | 2007-11-16 03:29:15 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:15 -0500 |
commit | e8d8d7fe8877c594c08f40cc7c013626cfe3e9cc (patch) | |
tree | 8b5e093454cf3d4dd1f58deacf35dc65f4c7f835 | |
parent | 448353caeab1d9180f12194a80790859ddbeebd5 (diff) |
KVM: x86 emulator: Rename 'cr2' to 'memop'
Previous patches have removed the dependency on cr2; we can now stop passing
it to the emulator and rename uses to 'memop'.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | drivers/kvm/x86.c | 1 | ||||
-rw-r--r-- | drivers/kvm/x86_emulate.c | 18 | ||||
-rw-r--r-- | drivers/kvm/x86_emulate.h | 1 |
3 files changed, 9 insertions, 11 deletions
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c index 5e5815604cbd..12f1d6fc92bb 100644 --- a/drivers/kvm/x86.c +++ b/drivers/kvm/x86.c | |||
@@ -1702,7 +1702,6 @@ int emulate_instruction(struct kvm_vcpu *vcpu, | |||
1702 | 1702 | ||
1703 | vcpu->emulate_ctxt.vcpu = vcpu; | 1703 | vcpu->emulate_ctxt.vcpu = vcpu; |
1704 | vcpu->emulate_ctxt.eflags = kvm_x86_ops->get_rflags(vcpu); | 1704 | vcpu->emulate_ctxt.eflags = kvm_x86_ops->get_rflags(vcpu); |
1705 | vcpu->emulate_ctxt.cr2 = cr2; | ||
1706 | vcpu->emulate_ctxt.mode = | 1705 | vcpu->emulate_ctxt.mode = |
1707 | (vcpu->emulate_ctxt.eflags & X86_EFLAGS_VM) | 1706 | (vcpu->emulate_ctxt.eflags & X86_EFLAGS_VM) |
1708 | ? X86EMUL_MODE_REAL : cs_l | 1707 | ? X86EMUL_MODE_REAL : cs_l |
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 3be506ac01a3..22fdf0ac6615 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -1127,13 +1127,13 @@ static inline int emulate_grp45(struct x86_emulate_ctxt *ctxt, | |||
1127 | 1127 | ||
1128 | static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt, | 1128 | static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt, |
1129 | struct x86_emulate_ops *ops, | 1129 | struct x86_emulate_ops *ops, |
1130 | unsigned long cr2) | 1130 | unsigned long memop) |
1131 | { | 1131 | { |
1132 | struct decode_cache *c = &ctxt->decode; | 1132 | struct decode_cache *c = &ctxt->decode; |
1133 | u64 old, new; | 1133 | u64 old, new; |
1134 | int rc; | 1134 | int rc; |
1135 | 1135 | ||
1136 | rc = ops->read_emulated(cr2, &old, 8, ctxt->vcpu); | 1136 | rc = ops->read_emulated(memop, &old, 8, ctxt->vcpu); |
1137 | if (rc != 0) | 1137 | if (rc != 0) |
1138 | return rc; | 1138 | return rc; |
1139 | 1139 | ||
@@ -1148,7 +1148,7 @@ static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt, | |||
1148 | new = ((u64)c->regs[VCPU_REGS_RCX] << 32) | | 1148 | new = ((u64)c->regs[VCPU_REGS_RCX] << 32) | |
1149 | (u32) c->regs[VCPU_REGS_RBX]; | 1149 | (u32) c->regs[VCPU_REGS_RBX]; |
1150 | 1150 | ||
1151 | rc = ops->cmpxchg_emulated(cr2, &old, &new, 8, ctxt->vcpu); | 1151 | rc = ops->cmpxchg_emulated(memop, &old, &new, 8, ctxt->vcpu); |
1152 | if (rc != 0) | 1152 | if (rc != 0) |
1153 | return rc; | 1153 | return rc; |
1154 | ctxt->eflags |= EFLG_ZF; | 1154 | ctxt->eflags |= EFLG_ZF; |
@@ -1211,7 +1211,7 @@ static inline int writeback(struct x86_emulate_ctxt *ctxt, | |||
1211 | int | 1211 | int |
1212 | x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) | 1212 | x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) |
1213 | { | 1213 | { |
1214 | unsigned long cr2 = ctxt->cr2; | 1214 | unsigned long memop = 0; |
1215 | u64 msr_data; | 1215 | u64 msr_data; |
1216 | unsigned long saved_eip = 0; | 1216 | unsigned long saved_eip = 0; |
1217 | struct decode_cache *c = &ctxt->decode; | 1217 | struct decode_cache *c = &ctxt->decode; |
@@ -1226,10 +1226,10 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) | |||
1226 | saved_eip = c->eip; | 1226 | saved_eip = c->eip; |
1227 | 1227 | ||
1228 | if (((c->d & ModRM) && (c->modrm_mod != 3)) || (c->d & MemAbs)) | 1228 | if (((c->d & ModRM) && (c->modrm_mod != 3)) || (c->d & MemAbs)) |
1229 | cr2 = c->modrm_ea; | 1229 | memop = c->modrm_ea; |
1230 | 1230 | ||
1231 | if (c->src.type == OP_MEM) { | 1231 | if (c->src.type == OP_MEM) { |
1232 | c->src.ptr = (unsigned long *)cr2; | 1232 | c->src.ptr = (unsigned long *)memop; |
1233 | c->src.val = 0; | 1233 | c->src.val = 0; |
1234 | rc = ops->read_emulated((unsigned long)c->src.ptr, | 1234 | rc = ops->read_emulated((unsigned long)c->src.ptr, |
1235 | &c->src.val, | 1235 | &c->src.val, |
@@ -1245,7 +1245,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) | |||
1245 | 1245 | ||
1246 | 1246 | ||
1247 | if (c->dst.type == OP_MEM) { | 1247 | if (c->dst.type == OP_MEM) { |
1248 | c->dst.ptr = (unsigned long *)cr2; | 1248 | c->dst.ptr = (unsigned long *)memop; |
1249 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; | 1249 | c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; |
1250 | c->dst.val = 0; | 1250 | c->dst.val = 0; |
1251 | if (c->d & BitOp) { | 1251 | if (c->d & BitOp) { |
@@ -1677,7 +1677,7 @@ twobyte_insn: | |||
1677 | &ctxt->eflags); | 1677 | &ctxt->eflags); |
1678 | break; | 1678 | break; |
1679 | case 7: /* invlpg*/ | 1679 | case 7: /* invlpg*/ |
1680 | emulate_invlpg(ctxt->vcpu, cr2); | 1680 | emulate_invlpg(ctxt->vcpu, memop); |
1681 | break; | 1681 | break; |
1682 | default: | 1682 | default: |
1683 | goto cannot_emulate; | 1683 | goto cannot_emulate; |
@@ -1848,7 +1848,7 @@ twobyte_special_insn: | |||
1848 | break; | 1848 | break; |
1849 | } | 1849 | } |
1850 | case 0xc7: /* Grp9 (cmpxchg8b) */ | 1850 | case 0xc7: /* Grp9 (cmpxchg8b) */ |
1851 | rc = emulate_grp9(ctxt, ops, cr2); | 1851 | rc = emulate_grp9(ctxt, ops, memop); |
1852 | if (rc != 0) | 1852 | if (rc != 0) |
1853 | goto done; | 1853 | goto done; |
1854 | break; | 1854 | break; |
diff --git a/drivers/kvm/x86_emulate.h b/drivers/kvm/x86_emulate.h index 644086e354a7..7db91b9bdcd4 100644 --- a/drivers/kvm/x86_emulate.h +++ b/drivers/kvm/x86_emulate.h | |||
@@ -145,7 +145,6 @@ struct x86_emulate_ctxt { | |||
145 | 145 | ||
146 | /* Linear faulting address (if emulating a page-faulting instruction). */ | 146 | /* Linear faulting address (if emulating a page-faulting instruction). */ |
147 | unsigned long eflags; | 147 | unsigned long eflags; |
148 | unsigned long cr2; | ||
149 | 148 | ||
150 | /* Emulated execution mode, represented by an X86EMUL_MODE value. */ | 149 | /* Emulated execution mode, represented by an X86EMUL_MODE value. */ |
151 | int mode; | 150 | int mode; |