summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-09-13 09:45:48 +0200
committerAvi Kivity <avi@redhat.com>2011-09-25 18:52:55 +0200
commit41ddf9784cb91c9e4d3a218eef3551bebe9c7362 (patch)
tree4920cc20989cbd852d9c62f5dc3aa94a44559d2f /arch
parentKVM: x86 emulator: switch src decode to decode_operand() (diff)
downloadlinux-41ddf9784cb91c9e4d3a218eef3551bebe9c7362.tar.xz
linux-41ddf9784cb91c9e4d3a218eef3551bebe9c7362.zip
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>
Diffstat (limited to 'arch')
-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,
rc = decode_imm(ctxt, op, 1, false);
break;
case OpMem:
- case OpMem64:
- if (d == OpMem64)
- ctxt->memop.bytes = 8;
- else
- ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
+ ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
mem_common:
*op = ctxt->memop;
ctxt->memopp = op;
@@ -3373,6 +3369,9 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
fetch_bit_operand(ctxt);
op->orig_val = op->val;
break;
+ case OpMem64:
+ ctxt->memop.bytes = 8;
+ goto mem_common;
case OpAcc:
op->type = OP_REG;
op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;