Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248106
b: refs/heads/master
c: d2f6276
h: refs/heads/master
v: v3
  • Loading branch information
Takuya Yoshikawa authored and Avi Kivity committed May 22, 2011
1 parent 5c3c11d commit ef6a3a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 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: 51187683cb11b959535d32eb91b673c6a9a03e88
refs/heads/master: d2f62766d5778bbaf80d4feb90a23c7edc371a54
36 changes: 22 additions & 14 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,23 @@ static inline int emulate_iret(struct x86_emulate_ctxt *ctxt,
}
}

static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
{
struct decode_cache *c = &ctxt->decode;
int rc;
unsigned short sel;

memcpy(&sel, c->src.valptr + c->op_bytes, 2);

rc = load_segment_descriptor(ctxt, ctxt->ops, sel, VCPU_SREG_CS);
if (rc != X86EMUL_CONTINUE)
return rc;

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

static int em_grp1a(struct x86_emulate_ctxt *ctxt)
{
struct decode_cache *c = &ctxt->decode;
Expand Down Expand Up @@ -1786,6 +1803,9 @@ static int em_grp45(struct x86_emulate_ctxt *ctxt)
case 4: /* jmp abs */
c->eip = c->src.val;
break;
case 5: /* jmp far */
rc = em_jmp_far(ctxt);
break;
case 6: /* push */
rc = em_push(ctxt);
break;
Expand Down Expand Up @@ -3997,19 +4017,9 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
}
case 0xe9: /* jmp rel */
goto jmp;
case 0xea: { /* jmp far */
unsigned short sel;
jump_far:
memcpy(&sel, c->src.valptr + c->op_bytes, 2);

rc = load_segment_descriptor(ctxt, ops, sel, VCPU_SREG_CS);
if (rc != X86EMUL_CONTINUE)
goto done;

c->eip = 0;
memcpy(&c->eip, c->src.valptr, c->op_bytes);
case 0xea: /* jmp far */
rc = em_jmp_far(ctxt);
break;
}
case 0xeb:
jmp: /* jmp rel short */
jmp_rel(c, c->src.val);
Expand Down Expand Up @@ -4073,8 +4083,6 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
rc = em_grp45(ctxt);
break;
case 0xff: /* Grp5 */
if (c->modrm_reg == 5)
goto jump_far;
rc = em_grp45(ctxt);
break;
default:
Expand Down

0 comments on commit ef6a3a2

Please sign in to comment.