Skip to contentSkip to conversation

2.4.23 lcopy_in_user backport

parisc-linux Joel Soete 2 participants 3 messages Dec 4, 2003 PA-RISC architecture

lore
Share & tools
lore

Joel Soete

author
#0 lore raw

Hi pa,

iirc this is a Carlos' chunk I try to backport:

=========><=========
diff -NaurX dontdiff linux-2.4.23-pa1/arch/parisc/lib/lusercopy.S linux-2.4.23-rc5-pa17/arch/parisc/lib/lusercopy.S
--- linux-2.4.23-pa1/arch/parisc/lib/lusercopy.S 2001-09-06 11:44:08.000000000
+0200
+++ linux-2.4.23-rc5-pa17/arch/parisc/lib/lusercopy.S 2003-10-23 18:21:44.000000000
+0200
@@ -133,6 +133,43 @@
.procend

/*
+ * unsigned long
+ * lcopy_in_user(void *to, const void *from, unsigned long n)
+ *
+ * Returns 0 for success.
+ * otherwise, returns number of bytes not transferred.
+ */
+
+ .export lcopy_in_user,code
+lcopy_in_user:
+ .proc
+ .callinfo NO_CALLS
+ .entry
+ comib,=,n 0,%r24,$lciu_done
+ get_sr
+$lciu_loop:
+ ldbs,ma 1(%sr1,%r25),%r1
+ addib,<> -1,%r24,$lciu_loop
+1: stbs,ma %r1,1(%sr1,%r26)
+$lciu_done:
+ bv %r0(%r2)
+ copy %r24,%r28
+ .exit
+
+2: b $lciu_done
+ ldo 1(%r24),%r24
+
+ .section __ex_table,"a"
+#ifdef __LP64__
+ .dword 1b,(2b-1b)
+#else
+ .word 1b,(2b-1b)
+#endif
+ .previous
+
+ .procend
+
+ /*
* long lstrncpy_from_user(char *dst, const char *src, long n)
*
* Returns -EFAULT if exception before terminator,
diff -NaurX dontdiff linux-2.4.23-pa1/include/asm-parisc/uaccess.h linux-2.4.23-rc5-pa17/include/asm-parisc/uaccess.h
--- linux-2.4.23-pa1/include/asm-parisc/uaccess.h 2003-11-12 07:25:38.000000000
+0100
+++ linux-2.4.23-rc5-pa17/include/asm-parisc/uaccess.h 2003-11-26 19:56:49.000000000
+0100
@@ -263,6 +263,7 @@

extern unsigned long lcopy_to_user(void *, const void *, unsigned long); extern unsigned long lcopy_from_user(void *, const void *, unsigned long);
+extern unsigned long lcopy_in_user(void *, const void *, unsigned long);
extern long lstrncpy_from_user(char *, const char *, long); extern unsigned lclear_user(void *,unsigned long);
extern long lstrnlen_user(const char *,long);
@@ -281,5 +282,7 @@
#define __copy_from_user lcopy_from_user
#define copy_to_user lcopy_to_user
#define __copy_to_user lcopy_to_user
+#define copy_in_user lcopy_in_user
+#define __copy_in_user lcopy_in_user

#endif /* __PARISC_UACCESS_H */
=========><=========

hth,
Joel

-------------------------------------------------------------------------
Tiscali ADSL: 12 mois à 29,50 €/mois! L'Internet rapide, c'est pour tout le monde.
http://reg.tiscali.be/default.asp?lg=fr

arch/parisc/lib/lusercopy.S +37 -0
diff -NaurX dontdiff linux-2.4.23-pa1/arch/parisc/lib/lusercopy.S linux-2.4.23-rc5-pa17/arch/parisc/lib/lusercopy.S
@@ -133,6 +133,43 @@
 	.procend
 
 	/*
+	 * unsigned long
+	 * lcopy_in_user(void *to, const void *from, unsigned long n)
+	 *
+	 * Returns 0 for success.
+	 * otherwise, returns number of bytes not transferred.
+	 */
+
+	.export lcopy_in_user,code
+lcopy_in_user:
+	.proc
+	.callinfo NO_CALLS
+	.entry
+	comib,=,n   0,%r24,$lciu_done
+	get_sr
+$lciu_loop:
+	ldbs,ma     1(%sr1,%r25),%r1
+	addib,<>    -1,%r24,$lciu_loop
+1:      stbs,ma     %r1,1(%sr1,%r26)
+$lciu_done:
+	bv          %r0(%r2)
+	copy        %r24,%r28
+	.exit
+
+2:      b $lciu_done
+	ldo         1(%r24),%r24
+
+	.section __ex_table,"a"
+#ifdef __LP64__
+	.dword      1b,(2b-1b)
+#else
+	.word       1b,(2b-1b)
+#endif
+	.previous
+
+	.procend
+
+	/*
 	 * long lstrncpy_from_user(char *dst, const char *src, long n)
 	 *
 	 * Returns -EFAULT if exception before terminator,
include/asm-parisc/uaccess.h +3 -0
diff -NaurX dontdiff linux-2.4.23-pa1/include/asm-parisc/uaccess.h linux-2.4.23-rc5-pa17/include/asm-parisc/uaccess.h
@@ -263,6 +263,7 @@
 
 extern unsigned long lcopy_to_user(void *, const void *, unsigned long);
 extern unsigned long lcopy_from_user(void *, const void *, unsigned long);
+extern unsigned long lcopy_in_user(void *, const void *, unsigned long);
 extern long lstrncpy_from_user(char *, const char *, long);
 extern unsigned lclear_user(void *,unsigned long);
 extern long lstrnlen_user(const char *,long);
@@ -281,5 +282,7 @@
 #define __copy_from_user lcopy_from_user
 #define copy_to_user lcopy_to_user
 #define __copy_to_user lcopy_to_user
+#define copy_in_user lcopy_in_user
+#define __copy_in_user lcopy_in_user
 
 #endif /* __PARISC_UACCESS_H */
#1 lore raw
Quoted 3 lines · Joel Soete

Hi pa,

iirc this is a Carlos' chunk I try to backport:

Why? Do we have a need for copy_in_user in 2.4?

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
author
#2 lore raw
Quoted 1 line

Why? Do we have a need for copy_in_user in 2.4?

Just trusted usefull because in sparc64 also?

J.

-------------------------------------------------------------------------
Tiscali ADSL: 12 mois à 29,50 €/mois! L'Internet rapide, c'est pour tout le monde.
http://reg.tiscali.be/default.asp?lg=fr