public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [PATCH 2/3] KVM: emulator: cleanup decode_register_operand() a bit
Date: Mon,  4 Nov 2013 15:52:42 +0200	[thread overview]
Message-ID: <1383573163-17865-2-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1383573163-17865-1-git-send-email-gleb@redhat.com>

Make code shorter.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 arch/x86/kvm/emulate.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 0bd372f..07ffca0 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1045,13 +1045,9 @@ static void decode_register_operand(struct x86_emulate_ctxt *ctxt,
 	}
 
 	op->type = OP_REG;
-	if (ctxt->d & ByteOp) {
-		op->addr.reg = decode_register(ctxt, reg, true);
-		op->bytes = 1;
-	} else {
-		op->addr.reg = decode_register(ctxt, reg, false);
-		op->bytes = ctxt->op_bytes;
-	}
+	op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
+	op->addr.reg = decode_register(ctxt, reg, ctxt->d & ByteOp);
+
 	fetch_register_operand(op);
 	op->orig_val = op->val;
 }
-- 
1.8.4.rc3


  reply	other threads:[~2013-11-04 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 13:52 [PATCH 1/3] KVM: emulator: check rex prefix inside decode_register() Gleb Natapov
2013-11-04 13:52 ` Gleb Natapov [this message]
2013-11-04 14:05   ` [PATCH 2/3] KVM: emulator: cleanup decode_register_operand() a bit Paolo Bonzini
2013-11-04 13:52 ` [PATCH 3/3] KVM: x86: trace cpuid emulation when called from emulator Gleb Natapov
2013-11-04 14:06   ` Paolo Bonzini
2013-11-04 14:04 ` [PATCH 1/3] KVM: emulator: check rex prefix inside decode_register() Paolo Bonzini
2013-11-04 14:06   ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383573163-17865-2-git-send-email-gleb@redhat.com \
    --to=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox