aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2007-06-19 04:21:15 -0400
committerAvi Kivity <avi@qumranet.com>2007-07-16 05:05:47 -0400
commitd9413cd757a7c96d97ddb46ab4e3e04760ae4c55 (patch)
treeed7a2e0c4b2122e78c343ce7c27560992da95bd4 /drivers/kvm
parent7f0aaee07b6afcf5a4ee8a1132447621d768076b (diff)
KVM: Implement emulation of instruction "ret" (opcode 0xc3)
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r--drivers/kvm/x86_emulate.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 46c38063a102..92620e48f06d 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -131,9 +131,9 @@ static u8 opcode_table[256] = {
131 /* 0xB0 - 0xBF */ 131 /* 0xB0 - 0xBF */
132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133 /* 0xC0 - 0xC7 */ 133 /* 0xC0 - 0xC7 */
134 ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImmByte | ModRM, 0, 0, 134 ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImmByte | ModRM,
135 0, 0, ByteOp | DstMem | SrcImm | ModRM | Mov, 135 0, ImplicitOps, 0, 0,
136 DstMem | SrcImm | ModRM | Mov, 136 ByteOp | DstMem | SrcImm | ModRM | Mov, DstMem | SrcImm | ModRM | Mov,
137 /* 0xC8 - 0xCF */ 137 /* 0xC8 - 0xCF */
138 0, 0, 0, 0, 0, 0, 0, 0, 138 0, 0, 0, 0, 0, 0, 0, 0,
139 /* 0xD0 - 0xD7 */ 139 /* 0xD0 - 0xD7 */
@@ -1156,14 +1156,18 @@ special_insn:
1156 case 0xf4: /* hlt */ 1156 case 0xf4: /* hlt */
1157 ctxt->vcpu->halt_request = 1; 1157 ctxt->vcpu->halt_request = 1;
1158 goto done; 1158 goto done;
1159 case 0xc3: /* ret */
1160 dst.ptr = &_eip;
1161 goto pop_instruction;
1159 case 0x58 ... 0x5f: /* pop reg */ 1162 case 0x58 ... 0x5f: /* pop reg */
1160 dst.ptr = (unsigned long *)&_regs[b & 0x7]; 1163 dst.ptr = (unsigned long *)&_regs[b & 0x7];
1161 1164
1165pop_instruction:
1162 if ((rc = ops->read_std(register_address(ctxt->ss_base, 1166 if ((rc = ops->read_std(register_address(ctxt->ss_base,
1163 _regs[VCPU_REGS_RSP]), dst.ptr, op_bytes, ctxt)) != 0) 1167 _regs[VCPU_REGS_RSP]), dst.ptr, op_bytes, ctxt)) != 0)
1164 goto done; 1168 goto done;
1165 1169
1166 register_address_increment(_regs[VCPU_REGS_RSP], dst.bytes); 1170 register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
1167 dst.orig_val = dst.val; /* Disable writeback. */ 1171 dst.orig_val = dst.val; /* Disable writeback. */
1168 break; 1172 break;
1169 } 1173 }