Commit f5f87dfb authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: emulate: simplify writeback

The "if/return" checks are useless, because we return X86EMUL_CONTINUE
anyway if we do not return.
Reviewed-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 54cfdb3e
...@@ -1588,34 +1588,28 @@ static void write_register_operand(struct operand *op) ...@@ -1588,34 +1588,28 @@ static void write_register_operand(struct operand *op)
static int writeback(struct x86_emulate_ctxt *ctxt, struct operand *op) static int writeback(struct x86_emulate_ctxt *ctxt, struct operand *op)
{ {
int rc;
switch (op->type) { switch (op->type) {
case OP_REG: case OP_REG:
write_register_operand(op); write_register_operand(op);
break; break;
case OP_MEM: case OP_MEM:
if (ctxt->lock_prefix) if (ctxt->lock_prefix)
rc = segmented_cmpxchg(ctxt, return segmented_cmpxchg(ctxt,
op->addr.mem, op->addr.mem,
&op->orig_val, &op->orig_val,
&op->val, &op->val,
op->bytes); op->bytes);
else else
rc = segmented_write(ctxt, return segmented_write(ctxt,
op->addr.mem, op->addr.mem,
&op->val, &op->val,
op->bytes); op->bytes);
if (rc != X86EMUL_CONTINUE)
return rc;
break; break;
case OP_MEM_STR: case OP_MEM_STR:
rc = segmented_write(ctxt, return segmented_write(ctxt,
op->addr.mem, op->addr.mem,
op->data, op->data,
op->bytes * op->count); op->bytes * op->count);
if (rc != X86EMUL_CONTINUE)
return rc;
break; break;
case OP_XMM: case OP_XMM:
write_sse_reg(ctxt, &op->vec_val, op->addr.xmm); write_sse_reg(ctxt, &op->vec_val, op->addr.xmm);
......
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