Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103737
b: refs/heads/master
c: f5b4edc
h: refs/heads/master
i:
  103735: d6b5ce4
v: v3
  • Loading branch information
Avi Kivity committed Jul 20, 2008
1 parent 5b1c1e6 commit 2b6a52c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 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: 84411d85dacdb6665578608c6a70fc8b819761a8
refs/heads/master: f5b4edcd52e78556800f90d08bfc9126416ac82f
23 changes: 5 additions & 18 deletions trunk/arch/x86/kvm/x86_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
{
struct decode_cache *c = &ctxt->decode;
u8 sib;
int index_reg = 0, base_reg = 0, scale, rip_relative = 0;
int index_reg = 0, base_reg = 0, scale;
int rc = 0;

if (c->rex_prefix) {
Expand Down Expand Up @@ -754,7 +754,7 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
c->modrm_ea += c->regs[index_reg] << scale;
} else if ((c->modrm_rm & 7) == 5 && c->modrm_mod == 0) {
if (ctxt->mode == X86EMUL_MODE_PROT64)
rip_relative = 1;
c->rip_relative = 1;
} else
c->modrm_ea += c->regs[c->modrm_rm];
switch (c->modrm_mod) {
Expand All @@ -770,22 +770,6 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
break;
}
}
if (rip_relative) {
c->modrm_ea += c->eip;
switch (c->d & SrcMask) {
case SrcImmByte:
c->modrm_ea += 1;
break;
case SrcImm:
if (c->d & ByteOp)
c->modrm_ea += 1;
else
if (c->op_bytes == 8)
c->modrm_ea += 4;
else
c->modrm_ea += c->op_bytes;
}
}
done:
return rc;
}
Expand Down Expand Up @@ -1044,6 +1028,9 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
break;
}

if (c->rip_relative)
c->modrm_ea += c->eip;

done:
return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-x86/kvm_x86_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ struct decode_cache {
u8 modrm_reg;
u8 modrm_rm;
u8 use_modrm_ea;
bool rip_relative;
unsigned long modrm_ea;
void *modrm_ptr;
unsigned long modrm_val;
Expand Down

0 comments on commit 2b6a52c

Please sign in to comment.