Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Carsten Langgaard <carstenl@mips.com>
To: Ralf Baechle <ralf@oss.sgi.com>,
	"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
	linux-mips@oss.sgi.com
Subject: memcpy.S patch in 64-bit
Date: Thu, 08 Aug 2002 15:24:47 +0200	[thread overview]
Message-ID: <3D52711F.D5C6A8FC@mips.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

The __copy_user function (in arch/mips64/lib/memcpy.S) calls __bzero.
We can't do that because __bzero might modify len, which we want to
return in case of an error.
The following patch take care of the problem.

/Carsten


--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com



[-- Attachment #2: memcpy.patch --]
[-- Type: text/plain, Size: 750 bytes --]

Index: arch/mips64/lib/memcpy.S
===================================================================
RCS file: /cvs/linux/arch/mips64/lib/memcpy.S,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 memcpy.S
--- arch/mips64/lib/memcpy.S	2002/08/05 23:53:36	1.9.2.1
+++ arch/mips64/lib/memcpy.S	2002/08/08 13:19:10
@@ -762,8 +762,18 @@
 	dsubu	a2, AT, ta0			# a2 bytes to go
 	daddu	a0, ta0				# compute start address in a1
 	dsubu	a0, a1
-	j	__bzero
-	 move	a1, zero
+	/*
+	 * Clear len bytes starting at dst.  Can't call __bzero because it
+	 * might modify len.  An inefficient loop for these rare times...
+	 */
+	beqz	a2, 2f
+	 dsubu	a1, a2, 1
+1:	sb	zero, 0(a0)
+	daddu	a0, a0, 1
+	bnez	a1, 1b
+	 dsubu	a1, a1, 1
+2:	jr	ra
+	 nop
 
 s_fixup:
 	jr	ra

             reply	other threads:[~2002-08-08 13:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-08 13:24 Carsten Langgaard [this message]
2002-08-08 15:08 ` memcpy.S patch in 64-bit Maciej W. Rozycki
2002-08-08 15:42   ` Ralf Baechle
2002-08-08 20:05   ` Carsten Langgaard
2002-08-09  8:41     ` Maciej W. Rozycki

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=3D52711F.D5C6A8FC@mips.com \
    --to=carstenl@mips.com \
    --cc=linux-mips@oss.sgi.com \
    --cc=macro@ds2.pg.gda.pl \
    --cc=ralf@oss.sgi.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