Subject: Question about copy_from_user()

From: Hiroyuki Machida <[email-masked]>
Date: Wed, 16 Feb 2000 18:34:29 +0900

Hi.

I think I found a redundant code in copy_from_user() and
__copy_from_user() at current CVS asm-mips/uaccess.h.

I think '*'-marked part in the definiton is obsolete and
redundant. It had to used in the exception fixup routine as
commented at arch/mips/lib/memcpy.S. (Of course the comment is also
obsolete, I think.)

#define __copy_from_user(to,from,n) ({ \
	void *__cu_to; \
	const void *__cu_from; \
	long __cu_len; \
	\
	__cu_to = (to); \
	__cu_from = (from); \
	__cu_len = (n); \
	__asm__ __volatile__( \
		"move\t$4, %1\n\t" \
		"move\t$5, %2\n\t" \
		"move\t$6, %3\n\t" \
*		".set\tnoat\n\t" \
*		"addu\t$1, %2, %3\n\t" \
*		".set\tat\n\t" \
		__MODULE_JAL(__copy_user) \
		"move\t%0, $6" \
		: "=r" (__cu_len) \
		: "r" (__cu_to), "r" (__cu_from), "r" (__cu_len) \
		: "$4", "$5", "$6", "$8", "$9", "$10", "$11", "$12", "$15", \
		  "$24", "$31","memory"); \
	__cu_len; \
})

(Even if $1 is still used at the exception fixup routine, when
MODULE is defined, __MODULE_JAL will overwrite $1 at the next line.)

Is my concern correct? Please let me know.

Thanks.
---
Hiroyuki Machida
Creative Station		SCE Inc./Sony Corp.

---

From: Ralf Baechle <[email-masked]>
Date: Fri, 18 Feb 2000 12:19:57 +0100

> commented at arch/mips/lib/memcpy.S. (Of course the comment is also

As you say $at is being used for the exception handling, so it obviously
isn't redundant as you say.  Or do I missunderstand what you were trying
to express?

You however made me stump over another bug, the definition of __MODULE_JAL
in <asm/uaccess.h> is wrong when compiling a module.  In that case the
generated code will clobber $at which actually should stay unchanged
for the exception handling.

  Ralf

---

From: Hiroyuki Machida <[email-masked]>
Date: Mon, 21 Feb 2000 11:04:36 +0900

From: Ralf Baechle <[email-masked]>
Subject: Re: Question about copy_from_user()
Date: Fri, 18 Feb 2000 12:19:57 +0100

> isn't redundant as you say.  Or do I missunderstand what you were trying

Thanks, Ralf.

I had miss-understood. I understood that $AT at the
copy_from_user is still meaningful. 

---
Hiroyuki Machida