All of lore.kernel.org
 help / color / mirror / Atom feed
* memcpy.S patch in 64-bit
@ 2002-08-08 13:24 Carsten Langgaard
  2002-08-08 15:08 ` Maciej W. Rozycki
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Langgaard @ 2002-08-08 13:24 UTC (permalink / raw)
  To: Ralf Baechle, Maciej W. Rozycki, linux-mips

[-- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: memcpy.S patch in 64-bit
  2002-08-08 13:24 memcpy.S patch in 64-bit Carsten Langgaard
@ 2002-08-08 15:08 ` Maciej W. Rozycki
  2002-08-08 15:42   ` Ralf Baechle
  2002-08-08 20:05   ` Carsten Langgaard
  0 siblings, 2 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2002-08-08 15:08 UTC (permalink / raw)
  To: Carsten Langgaard; +Cc: Ralf Baechle, linux-mips

On Thu, 8 Aug 2002, Carsten Langgaard wrote:

> 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.

 Hmm, how about simply cloning arch/mips/lib/memcpy.S?  It seems:

1. Designed to work on mips64 as well.

2. More up to date.

And it would ease maintenance. 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: memcpy.S patch in 64-bit
  2002-08-08 15:08 ` Maciej W. Rozycki
@ 2002-08-08 15:42   ` Ralf Baechle
  2002-08-08 20:05   ` Carsten Langgaard
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2002-08-08 15:42 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Carsten Langgaard, linux-mips

On Thu, Aug 08, 2002 at 05:08:07PM +0200, Maciej W. Rozycki wrote:

> > 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.
> 
>  Hmm, how about simply cloning arch/mips/lib/memcpy.S?  It seems:
> 
> 1. Designed to work on mips64 as well.
> 
> 2. More up to date.
> 
> And it would ease maintenance. 

Right but Carsten's patch is already ready, so I'm going to use it
for now.

  Ralf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: memcpy.S patch in 64-bit
  2002-08-08 15:08 ` 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
  1 sibling, 1 reply; 5+ messages in thread
From: Carsten Langgaard @ 2002-08-08 20:05 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Ralf Baechle, linux-mips

"Maciej W. Rozycki" wrote:

> On Thu, 8 Aug 2002, Carsten Langgaard wrote:
>
> > 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.
>
>  Hmm, how about simply cloning arch/mips/lib/memcpy.S?  It seems:
>
> 1. Designed to work on mips64 as well.
>
> 2. More up to date.
>
> And it would ease maintenance.
>

If it works then it's the right thing to do, so please go a head :-)


>
> --
> +  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
> +--------------------------------------------------------------+
> +        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: memcpy.S patch in 64-bit
  2002-08-08 20:05   ` Carsten Langgaard
@ 2002-08-09  8:41     ` Maciej W. Rozycki
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2002-08-09  8:41 UTC (permalink / raw)
  To: Carsten Langgaard; +Cc: Ralf Baechle, linux-mips

On Thu, 8 Aug 2002, Carsten Langgaard wrote:

> If it works then it's the right thing to do, so please go a head :-)

 I'll do that later, but don't hesitate to do it yourself if you have some
time to spare.  The most effort will likely be in testing. 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-08-09  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-08 13:24 memcpy.S patch in 64-bit Carsten Langgaard
2002-08-08 15:08 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.