Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215741
b: refs/heads/master
c: 0ef753b
h: refs/heads/master
i:
  215739: d119e7f
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent 6f4c748 commit b9e5a20
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7af04fc05cc185869271927eb470de3d25064b4a
refs/heads/master: 0ef753b8c323f5b8d75d7dc57ceef6b35982afdb
37 changes: 36 additions & 1 deletion trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,40 @@ static int em_das(struct x86_emulate_ctxt *ctxt)
return X86EMUL_CONTINUE;
}

static int em_call_far(struct x86_emulate_ctxt *ctxt)
{
struct decode_cache *c = &ctxt->decode;
u16 sel, old_cs;
ulong old_eip;
int rc;

old_cs = ctxt->ops->get_segment_selector(VCPU_SREG_CS, ctxt->vcpu);
old_eip = c->eip;

memcpy(&sel, c->src.valptr + c->op_bytes, 2);
if (load_segment_descriptor(ctxt, ctxt->ops, sel, VCPU_SREG_CS))
return X86EMUL_CONTINUE;

c->eip = 0;
memcpy(&c->eip, c->src.valptr, c->op_bytes);

c->src.val = old_cs;
emulate_push(ctxt, ctxt->ops);
rc = writeback(ctxt, ctxt->ops);
if (rc != X86EMUL_CONTINUE)
return rc;

c->src.val = old_eip;
emulate_push(ctxt, ctxt->ops);
rc = writeback(ctxt, ctxt->ops);
if (rc != X86EMUL_CONTINUE)
return rc;

c->dst.type = OP_NONE;

return X86EMUL_CONTINUE;
}

#define D(_y) { .flags = (_y) }
#define N D(0)
#define G(_f, _g) { .flags = ((_f) | Group), .u.group = (_g) }
Expand Down Expand Up @@ -2241,7 +2275,8 @@ static struct opcode group4[] = {

static struct opcode group5[] = {
D(DstMem | SrcNone | ModRM | Lock), D(DstMem | SrcNone | ModRM | Lock),
D(SrcMem | ModRM | Stack), N,
D(SrcMem | ModRM | Stack),
I(SrcMemFAddr | ModRM | ImplicitOps | Stack, em_call_far),
D(SrcMem | ModRM | Stack), D(SrcMemFAddr | ModRM | ImplicitOps),
D(SrcMem | ModRM | Stack), N,
};
Expand Down

0 comments on commit b9e5a20

Please sign in to comment.