From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" 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 Message-ID: <53582A26.6040408@zytor.com> References: <1397777591-6147-1-git-send-email-namit@cs.technion.ac.il> <1397794294-8414-1-git-send-email-namit@cs.technion.ac.il> <20140420092646.GB30377@minantech.com> <5356067D.40003@gmail.com> <20140423195832.GA32528@amt.cnet> <20140423201103.GA1167@amt.cnet> <53582853.30009@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Gleb Natapov , Nadav Amit , pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Nadav Amit , Marcelo Tosatti Return-path: In-Reply-To: <53582853.30009@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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 effect= ive >> operand size: >> =E2=80=A2 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 overrid= e > 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 n= ot > to be added to the rip higher half. >=20 > I guess another patch is needed for that as well. >=20 Yes, on x86 JMP really should be thought of as "MOV ...,IP/EIP/RIP". O= n 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 m= odel. -hpa