public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Nadav Amit <nadav.amit@gmail.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>,
	Nadav Amit <namit@cs.technion.ac.il>,
	pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] KVM: x86: RSI/RDI/RCX are zero-extended when affected by string ops
Date: Wed, 23 Apr 2014 14:01:26 -0700	[thread overview]
Message-ID: <53582A26.6040408@zytor.com> (raw)
In-Reply-To: <53582853.30009@gmail.com>

On 04/23/2014 01:53 PM, Nadav Amit wrote:
>>
>> Err, operand size is forced to 64-bits, not address size.
>>
>> "The following aspects of near branches are controlled by the effective
>> operand size:
>>   • Truncation of the size of the instruction pointer"
>>
>> Still, "67h call" should not truncate EIP (which your patch does).
>>
> Yes, I missed it.
> But if I am not mistaken again, it means that the existing
> implementation of jmp_rel is broken as well when address-size override
> prefix is used. In this case, as I see it, the existing masking would
> cause the carry from the add operation to the lower half of the rip not
> to be added to the rip higher half.
> 
> I guess another patch is needed for that as well.
> 

Yes, on x86 JMP really should be thought of as "MOV ...,IP/EIP/RIP".  On
some other architectures, e.g. m68k, JMP acts as if it was
"LEA ...,PC", which causes some serious confusion for people familiar
with that model.  However, on x86 considering JMP as a MOV to the IP
register really is very consistent and will give you the right mental model.

	-hpa



  reply	other threads:[~2014-04-23 21:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 23:33 [PATCH 0/5] KVM: x86: Fix KVM behavior that does not follow spec Nadav Amit
2014-04-18  0:35 ` [PATCH 1/5] KVM: x86: Fix wrong/stuck PMU when guest does not use PMI Nadav Amit
2014-04-18  0:35   ` [PATCH 2/5] KVM: x86: Fix CR3 reserved bits Nadav Amit
2014-05-10  7:13     ` Jan Kiszka
2014-05-10  7:24       ` [PATCH] KVM: x86: Fix CR3 reserved bits check in long mode Jan Kiszka
2014-05-12 10:46         ` Paolo Bonzini
2014-04-18  0:35   ` [PATCH 3/5] KVM: x86: IN instruction emulation should ignore REP-prefix Nadav Amit
2014-04-18  4:11 ` [PATCH 4/5] KVM: x86: RSI/RDI/RCX are zero-extended when affected by string ops Nadav Amit
2014-04-18  4:11   ` [PATCH 5/5] KVM: x86: Processor mode may be determined incorrectly Nadav Amit
2014-04-20  9:26   ` [PATCH 4/5] KVM: x86: RSI/RDI/RCX are zero-extended when affected by string ops Gleb Natapov
2014-04-22  6:04     ` Nadav Amit
2014-04-23 19:58       ` Marcelo Tosatti
2014-04-23 20:11         ` Marcelo Tosatti
2014-04-23 20:53           ` Nadav Amit
2014-04-23 21:01             ` H. Peter Anvin [this message]
2014-04-23 20:47 ` [PATCH 0/5] KVM: x86: Fix KVM behavior that does not follow spec Marcelo Tosatti

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=53582A26.6040408@zytor.com \
    --to=hpa@zytor.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=nadav.amit@gmail.com \
    --cc=namit@cs.technion.ac.il \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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