Re: [PATCH v7 2/5] x86/asm: add volatile, cl obbers and zero-length check in inline memcmp

"H. Peter Anvin" <[email protected]>
Newsgroups org.xenproject.lists.xen-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On July 25, 2026 3:34:45 AM PDT, David Laight <[email protected]> wrote:
>On Thu, 23 Jul 2026 20:49:13 -0400
>Brian Gerst <[email protected]> wrote:
>
>...
>> I had originally thought that the test for RCX==0 was also at the end
>> of the loop, after the decrement.  But a closer look at the
>> pseudo-code in the SDM does show that the test is at the start of the
>> loop.  Starting with RCX==0 does indeed skip the comparison and does
>> not touch ZF.  Your suggestion is good, but should have a comment
>> explaining why it's there to someone reading the code in the future.
>
>I have a feeling that was a change between the 8086 and 80286.
>I don't have an 8086 book (any more) but I'm sure I remember fixing
>bugs where %cx of zero caused 65536 iterations.
>(Fun to find because the vector table is 'first in the line to be
>overwritten.)
>
>	David

No, but on the Z80 0 meant 64K.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.