aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-09-13 03:45:48 -0400
committerAvi Kivity <avi@redhat.com>2011-09-25 12:52:55 -0400
commit41ddf9784cb91c9e4d3a218eef3551bebe9c7362 (patch)
tree4920cc20989cbd852d9c62f5dc3aa94a44559d2f
parent0fe591288470aebba4104b17513c9ad5050f9d0d (diff)
KVM: x86 emulator: simplify OpMem64 decode
Use the same technique as the other OpMem variants, and goto mem_common. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index e46809b8f31b..1c95935fe1b7 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3361,11 +3361,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
3361 rc = decode_imm(ctxt, op, 1, false); 3361 rc = decode_imm(ctxt, op, 1, false);
3362 break; 3362 break;
3363 case OpMem: 3363 case OpMem:
3364 case OpMem64: 3364 ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
3365 if (d == OpMem64)
3366 ctxt->memop.bytes = 8;
3367 else
3368 ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
3369 mem_common: 3365 mem_common:
3370 *op = ctxt->memop; 3366 *op = ctxt->memop;
3371 ctxt->memopp = op; 3367 ctxt->memopp = op;
@@ -3373,6 +3369,9 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
3373 fetch_bit_operand(ctxt); 3369 fetch_bit_operand(ctxt);
3374 op->orig_val = op->val; 3370 op->orig_val = op->val;
3375 break; 3371 break;
3372 case OpMem64:
3373 ctxt->memop.bytes = 8;
3374 goto mem_common;
3376 case OpAcc: 3375 case OpAcc:
3377 op->type = OP_REG; 3376 op->type = OP_REG;
3378 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; 3377 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;