linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@cse.unsw.edu.au>
To: Dave Gilbert <gilbertd@treblig.org>
Cc: linux-alpha@vger.kernel.org,
	Linus Torvalds <torvalds@transmeta.com>,
	linux-kernel@vger.kernel.org
Subject: memmove broken on alpha - was Re: NFS oddity (2.4.0test13pre4ac2 server, 2.0.36/2.2.14 clients)
Date: Sat, 30 Dec 2000 13:02:44 +1100 (EST)	[thread overview]
Message-ID: <14925.16964.875883.863169@notabene.cse.unsw.edu.au> (raw)
In-Reply-To: message from Dave Gilbert on Saturday December 30
In-Reply-To: <14925.12964.995179.63899@notabene.cse.unsw.edu.au> <Pine.LNX.4.10.10012300105100.26235-100000@tardis.home.dave>


[ extra detail included because I have added linux-alpha and lins to
the cc list] 

It appears that memmove is broken on the alpha architecture.

memmove is used by net/sunrpc/xdr.c:xdr_decode_string
to move a string 4 bytes down in memory.
memmove(X-4, X, 8) should change
    
 X:  00 00 00 08  67 69 6c 62 65 72 74 64
to
 X:  67 69 6c 62  65 72 74 64 65 72 74 64

Instead it changes it to

 X:  65 72 74 64  65 72 74 64 65 72 74 64

This is my first time in alpha assembler, but it looks fairly readable
and the comments help....

Working from 
  arch/alpha/lib/memmove.S

As the two regions overlap, it doesn't fall back on memcpy,
As the two regions are not co-aligned so it jumps to $misaligned.

Now the code in $misaligned, like all the code in memmove.S seems to
move a block of memory starting at the top, and moving downwards.
But in this example, we need to start at the bottom and move upwards.

Currently the code falls back on memcpy :

 if (dest+n <= src || dest >= src + n)

However if should also fall back on memcpy:
 
 if (dest <= src)

So the test should be:

  if (dest <= src || dest >= src + n)

which I think translates to the following patch:

--- arch/alpha/lib/memmove.S	2000/12/30 01:59:28	1.1
+++ arch/alpha/lib/memmove.S	2000/12/30 01:59:49
@@ -17,7 +17,7 @@
 memmove:
 	addq $16,$18,$4
 	addq $17,$18,$5
-	cmpule $4,$17,$1		/*  dest + n <= src  */
+	cmpule $16,$17,$1		/*  dest <= src  */
 	cmpule $5,$16,$2		/*  dest >= src + n  */
 
 	bis $1,$2,$1


NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-12-30  2:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-29 19:53 NFS oddity (2.4.0test13pre4ac2 server, 2.0.36/2.2.14 clients) Dave Gilbert
2000-12-29 21:04 ` Neil Brown
2000-12-29 22:55   ` Dave Gilbert
2000-12-30  0:56     ` Neil Brown
2000-12-30  1:07       ` Dave Gilbert
2000-12-30  2:02         ` Neil Brown [this message]
2000-12-30  3:18           ` memmove broken on alpha - was " Matti Aarnio
2000-12-30  8:08             ` Richard Henderson

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=14925.16964.875883.863169@notabene.cse.unsw.edu.au \
    --to=neilb@cse.unsw.edu.au \
    --cc=gilbertd@treblig.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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;
as well as URLs for NNTP newsgroup(s).