Commit 41ddf978 authored by Avi Kivity's avatar Avi Kivity

KVM: x86 emulator: simplify OpMem64 decode

Use the same technique as the other OpMem variants, and goto mem_common.
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 0fe59128
...@@ -3361,11 +3361,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, ...@@ -3361,11 +3361,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
rc = decode_imm(ctxt, op, 1, false); rc = decode_imm(ctxt, op, 1, false);
break; break;
case OpMem: case OpMem:
case OpMem64: ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
if (d == OpMem64)
ctxt->memop.bytes = 8;
else
ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
mem_common: mem_common:
*op = ctxt->memop; *op = ctxt->memop;
ctxt->memopp = op; ctxt->memopp = op;
...@@ -3373,6 +3369,9 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, ...@@ -3373,6 +3369,9 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
fetch_bit_operand(ctxt); fetch_bit_operand(ctxt);
op->orig_val = op->val; op->orig_val = op->val;
break; break;
case OpMem64:
ctxt->memop.bytes = 8;
goto mem_common;
case OpAcc: case OpAcc:
op->type = OP_REG; op->type = OP_REG;
op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment