aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-11-27 10:36:41 -0500
committerAvi Kivity <avi@redhat.com>2008-12-31 09:55:04 -0500
commitfaa5a3ae39483aefc46a78299c811194f953af27 (patch)
tree2b7be7e171ce5292f7acb6de1ebcd4478d356678 /arch
parentb82091824ee4970adf92d5cd6d57b12273171625 (diff)
KVM: x86 emulator: Extract 'pop' sequence into a function
Switch 'pop r/m' instruction to use the new function. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/x86_emulate.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index a11af6f74d68..2555762f4b42 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -1057,20 +1057,33 @@ static inline void emulate_push(struct x86_emulate_ctxt *ctxt)
1057 c->regs[VCPU_REGS_RSP]); 1057 c->regs[VCPU_REGS_RSP]);
1058} 1058}
1059 1059
1060static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt, 1060static int emulate_pop(struct x86_emulate_ctxt *ctxt,
1061 struct x86_emulate_ops *ops) 1061 struct x86_emulate_ops *ops)
1062{ 1062{
1063 struct decode_cache *c = &ctxt->decode; 1063 struct decode_cache *c = &ctxt->decode;
1064 int rc; 1064 int rc;
1065 1065
1066 rc = ops->read_std(register_address(c, ss_base(ctxt), 1066 rc = ops->read_std(register_address(c, ss_base(ctxt),
1067 c->regs[VCPU_REGS_RSP]), 1067 c->regs[VCPU_REGS_RSP]),
1068 &c->dst.val, c->dst.bytes, ctxt->vcpu); 1068 &c->src.val, c->src.bytes, ctxt->vcpu);
1069 if (rc != 0) 1069 if (rc != 0)
1070 return rc; 1070 return rc;
1071 1071
1072 register_address_increment(c, &c->regs[VCPU_REGS_RSP], c->dst.bytes); 1072 register_address_increment(c, &c->regs[VCPU_REGS_RSP], c->src.bytes);
1073 return rc;
1074}
1073 1075
1076static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt,
1077 struct x86_emulate_ops *ops)
1078{
1079 struct decode_cache *c = &ctxt->decode;
1080 int rc;
1081
1082 c->src.bytes = c->dst.bytes;
1083 rc = emulate_pop(ctxt, ops);
1084 if (rc != 0)
1085 return rc;
1086 c->dst.val = c->src.val;
1074 return 0; 1087 return 0;
1075} 1088}
1076 1089