KVM: x86 emulator: Complete decoding of call near in decode stage
authorGleb Natapov <gleb@redhat.com>
Sun, 12 Apr 2009 10:36:36 +0000 (13:36 +0300)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:41 +0000 (11:48 +0300)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86_emulate.c

index 14b8ee2c09e96cee36a3c79d7c7e64b4a15defac..4a9cd4c2b983187ab31a3fc448a702b68c5f622f 100644 (file)
@@ -192,7 +192,7 @@ static u32 opcode_table[256] = {
        SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
        SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
        /* 0xE8 - 0xEF */
-       ImplicitOps | Stack, SrcImm | ImplicitOps,
+       SrcImm | Stack, SrcImm | ImplicitOps,
        SrcImm | Src2Imm16, SrcImmByte | ImplicitOps,
        SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
        SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps,
@@ -1781,18 +1781,7 @@ special_insn:
                io_dir_in = 0;
                goto do_io;
        case 0xe8: /* call (near) */ {
-               long int rel;
-               switch (c->op_bytes) {
-               case 2:
-                       rel = insn_fetch(s16, 2, c->eip);
-                       break;
-               case 4:
-                       rel = insn_fetch(s32, 4, c->eip);
-                       break;
-               default:
-                       DPRINTF("Call: Invalid op_bytes\n");
-                       goto cannot_emulate;
-               }
+               long int rel = c->src.val;
                c->src.val = (unsigned long) c->eip;
                jmp_rel(c, rel);
                emulate_push(ctxt);