Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215717
b: refs/heads/master
c: 35c843c
h: refs/heads/master
i:
  215715: edbb773
v: v3
  • Loading branch information
Wei Yongjun authored and Avi Kivity committed Oct 24, 2010
1 parent 2830ec2 commit 1a41a19
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 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: 8744aa9aad56be756a58126b429f176898631c3f
refs/heads/master: 35c843c4857e2a818d1d951d87c40ee2cf5c1be8
24 changes: 18 additions & 6 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,22 @@ static int decode_abs(struct x86_emulate_ctxt *ctxt,
return rc;
}

static void fetch_bit_operand(struct decode_cache *c)
{
long sv, mask;

if (c->dst.type == OP_MEM) {
mask = ~(c->dst.bytes * 8 - 1);

if (c->src.bytes == 2)
sv = (s16)c->src.val & (s16)mask;
else if (c->src.bytes == 4)
sv = (s32)c->src.val & (s32)mask;

c->dst.addr.mem += (sv >> 3);
}
}

static int read_emulated(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops,
unsigned long addr, void *dest, unsigned size)
Expand Down Expand Up @@ -2638,12 +2654,8 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt)
c->dst.bytes = 8;
else
c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes;
if (c->dst.type == OP_MEM && (c->d & BitOp)) {
unsigned long mask = ~(c->dst.bytes * 8 - 1);

c->dst.addr.mem = c->dst.addr.mem +
(c->src.val & mask) / 8;
}
if (c->d & BitOp)
fetch_bit_operand(c);
c->dst.orig_val = c->dst.val;
break;
case DstAcc:
Expand Down

0 comments on commit 1a41a19

Please sign in to comment.