diff options
author | Avi Kivity <avi@redhat.com> | 2010-08-18 08:12:09 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:51:12 -0400 |
commit | 40ece7c7297da90e54e147d3bfbb4531f9fbc570 (patch) | |
tree | d110faf0128a5a1d017ee34e283e882923bf18ef /arch/x86/kvm/emulate.c | |
parent | b250e605895d02cede78922d034f7825af72a8b5 (diff) |
KVM: x86 emulator: implement RET imm16 (opcode C2)
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index db80e28471da..9e58f5054c39 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -2249,6 +2249,21 @@ static int em_call_far(struct x86_emulate_ctxt *ctxt) | |||
2249 | return X86EMUL_CONTINUE; | 2249 | return X86EMUL_CONTINUE; |
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | static int em_ret_near_imm(struct x86_emulate_ctxt *ctxt) | ||
2253 | { | ||
2254 | struct decode_cache *c = &ctxt->decode; | ||
2255 | int rc; | ||
2256 | |||
2257 | c->dst.type = OP_REG; | ||
2258 | c->dst.addr.reg = &c->eip; | ||
2259 | c->dst.bytes = c->op_bytes; | ||
2260 | rc = emulate_pop(ctxt, ctxt->ops, &c->dst.val, c->op_bytes); | ||
2261 | if (rc != X86EMUL_CONTINUE) | ||
2262 | return rc; | ||
2263 | register_address_increment(c, &c->regs[VCPU_REGS_RSP], c->src.val); | ||
2264 | return X86EMUL_CONTINUE; | ||
2265 | } | ||
2266 | |||
2252 | #define D(_y) { .flags = (_y) } | 2267 | #define D(_y) { .flags = (_y) } |
2253 | #define N D(0) | 2268 | #define N D(0) |
2254 | #define G(_f, _g) { .flags = ((_f) | Group), .u.group = (_g) } | 2269 | #define G(_f, _g) { .flags = ((_f) | Group), .u.group = (_g) } |
@@ -2394,7 +2409,9 @@ static struct opcode opcode_table[256] = { | |||
2394 | X8(D(DstReg | SrcImm | Mov)), | 2409 | X8(D(DstReg | SrcImm | Mov)), |
2395 | /* 0xC0 - 0xC7 */ | 2410 | /* 0xC0 - 0xC7 */ |
2396 | D(ByteOp | DstMem | SrcImm | ModRM), D(DstMem | SrcImmByte | ModRM), | 2411 | D(ByteOp | DstMem | SrcImm | ModRM), D(DstMem | SrcImmByte | ModRM), |
2397 | N, D(ImplicitOps | Stack), N, N, | 2412 | I(ImplicitOps | Stack | SrcImmU16, em_ret_near_imm), |
2413 | D(ImplicitOps | Stack), | ||
2414 | N, N, | ||
2398 | D(ByteOp | DstMem | SrcImm | ModRM | Mov), D(DstMem | SrcImm | ModRM | Mov), | 2415 | D(ByteOp | DstMem | SrcImm | ModRM | Mov), D(DstMem | SrcImm | ModRM | Mov), |
2399 | /* 0xC8 - 0xCF */ | 2416 | /* 0xC8 - 0xCF */ |
2400 | N, N, N, D(ImplicitOps | Stack), | 2417 | N, N, N, D(ImplicitOps | Stack), |