public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>,
	linux-kernel@vger.kernel.org, Avi Kivity <avi.kivity@gmail.com>
Subject: Re: [PATCH] x86/kvm/emulate.c: simplify NOP (opcode 0x90) check
Date: Thu, 04 Jul 2013 13:08:08 +0200	[thread overview]
Message-ID: <51D55798.5090404@redhat.com> (raw)
In-Reply-To: <51D55728.4060909@redhat.com>

Il 04/07/2013 13:06, Denys Vlasenko ha scritto:
>>> >> -	case 0x90 ... 0x97: /* nop / xchg reg, rax */
>>> >> -		if (ctxt->dst.addr.reg == reg_rmw(ctxt, VCPU_REGS_RAX))
>>> >> -			break;
>>> >> +	case 0x90: /* nop */
>>> >> +		break;
>> > This does not work on 64bit and REX prefix.
> Can you elaborate?
> 
> 0x90 is special-cased in CPU to be a NOP regardless of bit width.
> IOW, xchg %eax,%eax ordinarily would clear upper 32 bits of %rax,
> but 0x90 doesn't do that.
> 
> Do you mean that with REX.R==1, 0x90 will refer to R8?

Yes.

$ echo 'xchg %rax,%r8' | as
$ objdump -d a.out

a.out:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:	49 90                	xchg   %rax,%r8


Paolo

      parent reply	other threads:[~2013-07-04 11:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04  8:58 [PATCH] x86/kvm/emulate.c: simplify NOP (opcode 0x90) check Denys Vlasenko
2013-07-04  9:13 ` Gleb Natapov
2013-07-04 11:06   ` Denys Vlasenko
2013-07-04 11:07     ` Gleb Natapov
2013-07-04 11:08     ` Paolo Bonzini [this message]

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=51D55798.5090404@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=avi.kivity@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=gleb@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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