patch-2.3.23 linux/arch/arm/lib/uaccess.S

Next file: linux/arch/arm/mm/Makefile
Previous file: linux/arch/arm/lib/uaccess-armo.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.22/linux/arch/arm/lib/uaccess.S linux/arch/arm/lib/uaccess.S
@@ -42,11 +42,11 @@
 		rsb	ip, ip, #4
 		cmp	ip, #2
 		ldrb	r3, [r1], #1
-USER(		strbt	r3, [r0], #1)			// May fault
+USER(		strbt	r3, [r0], #1)			@ May fault
 		ldrgeb	r3, [r1], #1
-USER(		strgebt	r3, [r0], #1)			// May fault
+USER(		strgebt	r3, [r0], #1)			@ May fault
 		ldrgtb	r3, [r1], #1
-USER(		strgtbt	r3, [r0], #1)			// May fault
+USER(		strgtbt	r3, [r0], #1)			@ May fault
 		sub	r2, r2, ip
 		b	.c2u_dest_aligned
 
@@ -69,8 +69,8 @@
 		addmi	ip, r2, #4
 		bmi	.c2u_0nowords
 		ldr	r3, [r1], #4
-USER(		strt	r3, [r0], #4)			// May fault
-		mov	ip, r0, lsl #32 - PAGE_SHIFT	// On each page, use a ld/st??t instruction
+USER(		strt	r3, [r0], #4)			@ May fault
+		mov	ip, r0, lsl #32 - PAGE_SHIFT	@ On each page, use a ld/st??t instruction
 		rsb	ip, ip, #0
 		movs	ip, ip, lsr #32 - PAGE_SHIFT
 		beq	.c2u_0fupi
@@ -84,31 +84,31 @@
 		blt	.c2u_0rem8lp
 
 .c2u_0cpy8lp:	ldmia	r1!, {r3 - r6}
-		stmia	r0!, {r3 - r6}			// Shouldn't fault
+		stmia	r0!, {r3 - r6}			@ Shouldn't fault
 		ldmia	r1!, {r3 - r6}
-		stmia	r0!, {r3 - r6}			// Shouldn't fault
+		stmia	r0!, {r3 - r6}			@ Shouldn't fault
 		subs	ip, ip, #32
 		bpl	.c2u_0cpy8lp
 .c2u_0rem8lp:	cmn	ip, #16
 		ldmgeia	r1!, {r3 - r6}
-		stmgeia	r0!, {r3 - r6}			// Shouldn't fault
+		stmgeia	r0!, {r3 - r6}			@ Shouldn't fault
 		tst	ip, #8
 		ldmneia	r1!, {r3 - r4}
-		stmneia	r0!, {r3 - r4}			// Shouldn't fault
+		stmneia	r0!, {r3 - r4}			@ Shouldn't fault
 		tst	ip, #4
 		ldrne	r3, [r1], #4
-		strnet	r3, [r0], #4			// Shouldn't fault
+		strnet	r3, [r0], #4			@ Shouldn't fault
 		ands	ip, ip, #3
 		beq	.c2u_0fupi
 .c2u_0nowords:	teq	ip, #0
 		beq	.c2u_finished
 .c2u_nowords:	cmp	ip, #2
 		ldrb	r3, [r1], #1
-USER(		strbt	r3, [r0], #1)			// May fault
+USER(		strbt	r3, [r0], #1)			@ May fault
 		ldrgeb	r3, [r1], #1
-USER(		strgebt	r3, [r0], #1)			// May fault
+USER(		strgebt	r3, [r0], #1)			@ May fault
 		ldrgtb	r3, [r1], #1
-USER(		strgtbt	r3, [r0], #1)			// May fault
+USER(		strgtbt	r3, [r0], #1)			@ May fault
 		b	.c2u_finished
 
 .c2u_not_enough:
@@ -129,7 +129,7 @@
 		mov	r3, r7, lsr #8
 		ldr	r7, [r1], #4
 		orr	r3, r3, r7, lsl #24
-USER(		strt	r3, [r0], #4)			// May fault
+USER(		strt	r3, [r0], #4)			@ May fault
 		mov	ip, r0, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
 		movs	ip, ip, lsr #32 - PAGE_SHIFT
@@ -149,7 +149,7 @@
 		orr	r5, r5, r6, lsl #24
 		mov	r6, r6, lsr #8
 		orr	r6, r6, r7, lsl #24
-		stmia	r0!, {r3 - r6}			// Shouldn't fault
+		stmia	r0!, {r3 - r6}			@ Shouldn't fault
 		subs	ip, ip, #16
 		bpl	.c2u_1cpy8lp
 .c2u_1rem8lp:	tst	ip, #8
@@ -158,23 +158,23 @@
 		orrne	r3, r3, r4, lsl #24
 		movne	r4, r4, lsr #8
 		orrne	r4, r4, r7, lsl #24
-		stmneia	r0!, {r3 - r4}			// Shouldn't fault
+		stmneia	r0!, {r3 - r4}			@ Shouldn't fault
 		tst	ip, #4
 		movne	r3, r7, lsr #8
 		ldrne	r7, [r1], #4
 		orrne	r3, r3, r7, lsl #24
-		strnet	r3, [r0], #4			// Shouldn't fault
+		strnet	r3, [r0], #4			@ Shouldn't fault
 		ands	ip, ip, #3
 		beq	.c2u_1fupi
 .c2u_1nowords:	mov	r3, r7, lsr #8
 		teq	ip, #0
 		beq	.c2u_finished
 		cmp	ip, #2
-USER(		strbt	r3, [r0], #1)			// May fault
+USER(		strbt	r3, [r0], #1)			@ May fault
 		movge	r3, r3, lsr #8
-USER(		strgebt	r3, [r0], #1)			// May fault
+USER(		strgebt	r3, [r0], #1)			@ May fault
 		movgt	r3, r3, lsr #8
-USER(		strgtbt	r3, [r0], #1)			// May fault
+USER(		strgtbt	r3, [r0], #1)			@ May fault
 		b	.c2u_finished
 
 .c2u_2fupi:	subs	r2, r2, #4
@@ -183,7 +183,7 @@
 		mov	r3, r7, lsr #16
 		ldr	r7, [r1], #4
 		orr	r3, r3, r7, lsl #16
-USER(		strt	r3, [r0], #4)			// May fault
+USER(		strt	r3, [r0], #4)			@ May fault
 		mov	ip, r0, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
 		movs	ip, ip, lsr #32 - PAGE_SHIFT
@@ -203,7 +203,7 @@
 		orr	r5, r5, r6, lsl #16
 		mov	r6, r6, lsr #16
 		orr	r6, r6, r7, lsl #16
-		stmia	r0!, {r3 - r6}			// Shouldn't fault
+		stmia	r0!, {r3 - r6}			@ Shouldn't fault
 		subs	ip, ip, #16
 		bpl	.c2u_2cpy8lp
 .c2u_2rem8lp:	tst	ip, #8
@@ -212,23 +212,23 @@
 		orrne	r3, r3, r4, lsl #16
 		movne	r4, r4, lsr #16
 		orrne	r4, r4, r7, lsl #16
-		stmneia	r0!, {r3 - r4}			// Shouldn't fault
+		stmneia	r0!, {r3 - r4}			@ Shouldn't fault
 		tst	ip, #4
 		movne	r3, r7, lsr #16
 		ldrne	r7, [r1], #4
 		orrne	r3, r3, r7, lsl #16
-		strnet	r3, [r0], #4			// Shouldn't fault
+		strnet	r3, [r0], #4			@ Shouldn't fault
 		ands	ip, ip, #3
 		beq	.c2u_2fupi
 .c2u_2nowords:	mov	r3, r7, lsr #16
 		teq	ip, #0
 		beq	.c2u_finished
 		cmp	ip, #2
-USER(		strbt	r3, [r0], #1)			// May fault
+USER(		strbt	r3, [r0], #1)			@ May fault
 		movge	r3, r3, lsr #8
-USER(		strgebt	r3, [r0], #1)			// May fault
+USER(		strgebt	r3, [r0], #1)			@ May fault
 		ldrgtb	r3, [r1], #0
-USER(		strgtbt	r3, [r0], #1)			// May fault
+USER(		strgtbt	r3, [r0], #1)			@ May fault
 		b	.c2u_finished
 
 .c2u_3fupi:	subs	r2, r2, #4
@@ -237,7 +237,7 @@
 		mov	r3, r7, lsr #24
 		ldr	r7, [r1], #4
 		orr	r3, r3, r7, lsl #8
-USER(		strt	r3, [r0], #4)			// May fault
+USER(		strt	r3, [r0], #4)			@ May fault
 		mov	ip, r0, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
 		movs	ip, ip, lsr #32 - PAGE_SHIFT
@@ -257,7 +257,7 @@
 		orr	r5, r5, r6, lsl #8
 		mov	r6, r6, lsr #24
 		orr	r6, r6, r7, lsl #8
-		stmia	r0!, {r3 - r6}			// Shouldn't fault
+		stmia	r0!, {r3 - r6}			@ Shouldn't fault
 		subs	ip, ip, #16
 		bpl	.c2u_3cpy8lp
 .c2u_3rem8lp:	tst	ip, #8
@@ -266,23 +266,23 @@
 		orrne	r3, r3, r4, lsl #8
 		movne	r4, r4, lsr #24
 		orrne	r4, r4, r7, lsl #8
-		stmneia	r0!, {r3 - r4}			// Shouldn't fault
+		stmneia	r0!, {r3 - r4}			@ Shouldn't fault
 		tst	ip, #4
 		movne	r3, r7, lsr #24
 		ldrne	r7, [r1], #4
 		orrne	r3, r3, r7, lsl #8
-		strnet	r3, [r0], #4			// Shouldn't fault
+		strnet	r3, [r0], #4			@ Shouldn't fault
 		ands	ip, ip, #3
 		beq	.c2u_3fupi
 .c2u_3nowords:	mov	r3, r7, lsr #24
 		teq	ip, #0
 		beq	.c2u_finished
 		cmp	ip, #2
-USER(		strbt	r3, [r0], #1)			// May fault
+USER(		strbt	r3, [r0], #1)			@ May fault
 		ldrge	r3, [r1], #0
-USER(		strgebt	r3, [r0], #1)			// May fault
+USER(		strgebt	r3, [r0], #1)			@ May fault
 		movgt	r3, r3, lsr #8
-USER(		strgtbt	r3, [r0], #1)			// May fault
+USER(		strgtbt	r3, [r0], #1)			@ May fault
 		b	.c2u_finished
 
 #ifndef TESTING
@@ -302,11 +302,11 @@
 .cfu_dest_not_aligned:
 		rsb	ip, ip, #4
 		cmp	ip, #2
-USER(		ldrbt	r3, [r1], #1)			// May fault
+USER(		ldrbt	r3, [r1], #1)			@ May fault
 		strb	r3, [r0], #1
-USER(		ldrgebt	r3, [r1], #1)			// May fault
+USER(		ldrgebt	r3, [r1], #1)			@ May fault
 		strgeb	r3, [r0], #1
-USER(		ldrgtbt	r3, [r1], #1)			// May fault
+USER(		ldrgtbt	r3, [r1], #1)			@ May fault
 		strgtb	r3, [r0], #1
 		sub	r2, r2, ip
 		b	.cfu_dest_aligned
@@ -330,7 +330,7 @@
 		bmi	.cfu_0nowords
 USER(		ldrt	r3, [r1], #4)
 		str	r3, [r0], #4
-		mov	ip, r1, lsl #32 - PAGE_SHIFT	// On each page, use a ld/st??t instruction
+		mov	ip, r1, lsl #32 - PAGE_SHIFT	@ On each page, use a ld/st??t instruction
 		rsb	ip, ip, #0
 		movs	ip, ip, lsr #32 - PAGE_SHIFT
 		beq	.cfu_0fupi
@@ -343,31 +343,31 @@
 		subs	ip, ip, #32
 		blt	.cfu_0rem8lp
 
-.cfu_0cpy8lp:	ldmia	r1!, {r3 - r6}			// Shouldn't fault
+.cfu_0cpy8lp:	ldmia	r1!, {r3 - r6}			@ Shouldn't fault
 		stmia	r0!, {r3 - r6}
-		ldmia	r1!, {r3 - r6}			// Shouldn't fault
+		ldmia	r1!, {r3 - r6}			@ Shouldn't fault
 		stmia	r0!, {r3 - r6}
 		subs	ip, ip, #32
 		bpl	.cfu_0cpy8lp
 .cfu_0rem8lp:	cmn	ip, #16
-		ldmgeia	r1!, {r3 - r6}			// Shouldn't fault
+		ldmgeia	r1!, {r3 - r6}			@ Shouldn't fault
 		stmgeia	r0!, {r3 - r6}
 		tst	ip, #8
-		ldmneia	r1!, {r3 - r4}			// Shouldn't fault
+		ldmneia	r1!, {r3 - r4}			@ Shouldn't fault
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
-		ldrnet	r3, [r1], #4			// Shouldn't fault
+		ldrnet	r3, [r1], #4			@ Shouldn't fault
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
 		beq	.cfu_0fupi
 .cfu_0nowords:	teq	ip, #0
 		beq	.cfu_finished
 .cfu_nowords:	cmp	ip, #2
-USER(		ldrbt	r3, [r1], #1)			// May fault
+USER(		ldrbt	r3, [r1], #1)			@ May fault
 		strb	r3, [r0], #1
-USER(		ldrgebt	r3, [r1], #1)			// May fault
+USER(		ldrgebt	r3, [r1], #1)			@ May fault
 		strgeb	r3, [r0], #1
-USER(		ldrgtbt	r3, [r1], #1)			// May fault
+USER(		ldrgtbt	r3, [r1], #1)			@ May fault
 		strgtb	r3, [r0], #1
 		b	.cfu_finished
 
@@ -380,7 +380,7 @@
 
 .cfu_src_not_aligned:
 		bic	r1, r1, #3
-USER(		ldrt	r7, [r1], #4)			// May fault
+USER(		ldrt	r7, [r1], #4)			@ May fault
 		cmp	ip, #2
 		bgt	.cfu_3fupi
 		beq	.cfu_2fupi
@@ -388,7 +388,7 @@
 		addmi	ip, r2, #4
 		bmi	.cfu_1nowords
 		mov	r3, r7, lsr #8
-USER(		ldrt	r7, [r1], #4)			// May fault
+USER(		ldrt	r7, [r1], #4)			@ May fault
 		orr	r3, r3, r7, lsl #24
 		str	r3, [r0], #4
 		mov	ip, r1, lsl #32 - PAGE_SHIFT
@@ -402,7 +402,7 @@
 		blt	.cfu_1rem8lp
 
 .cfu_1cpy8lp:	mov	r3, r7, lsr #8
-		ldmia	r1!, {r4 - r7}			// Shouldn't fault
+		ldmia	r1!, {r4 - r7}			@ Shouldn't fault
 		orr	r3, r3, r4, lsl #24
 		mov	r4, r4, lsr #8
 		orr	r4, r4, r5, lsl #24
@@ -415,14 +415,14 @@
 		bpl	.cfu_1cpy8lp
 .cfu_1rem8lp:	tst	ip, #8
 		movne	r3, r7, lsr #8
-		ldmneia	r1!, {r4, r7}			// Shouldn't fault
+		ldmneia	r1!, {r4, r7}			@ Shouldn't fault
 		orrne	r3, r3, r4, lsl #24
 		movne	r4, r4, lsr #8
 		orrne	r4, r4, r7, lsl #24
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
 		movne	r3, r7, lsr #8
-USER(		ldrnet	r7, [r1], #4)			// May fault
+USER(		ldrnet	r7, [r1], #4)			@ May fault
 		orrne	r3, r3, r7, lsl #24
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
@@ -442,7 +442,7 @@
 		addmi	ip, r2, #4
 		bmi	.cfu_2nowords
 		mov	r3, r7, lsr #16
-USER(		ldrt	r7, [r1], #4)			// May fault
+USER(		ldrt	r7, [r1], #4)			@ May fault
 		orr	r3, r3, r7, lsl #16
 		str	r3, [r0], #4
 		mov	ip, r1, lsl #32 - PAGE_SHIFT
@@ -456,7 +456,7 @@
 		blt	.cfu_2rem8lp
 
 .cfu_2cpy8lp:	mov	r3, r7, lsr #16
-		ldmia	r1!, {r4 - r7}			// Shouldn't fault
+		ldmia	r1!, {r4 - r7}			@ Shouldn't fault
 		orr	r3, r3, r4, lsl #16
 		mov	r4, r4, lsr #16
 		orr	r4, r4, r5, lsl #16
@@ -469,14 +469,14 @@
 		bpl	.cfu_2cpy8lp
 .cfu_2rem8lp:	tst	ip, #8
 		movne	r3, r7, lsr #16
-		ldmneia	r1!, {r4, r7}			// Shouldn't fault
+		ldmneia	r1!, {r4, r7}			@ Shouldn't fault
 		orrne	r3, r3, r4, lsl #16
 		movne	r4, r4, lsr #16
 		orrne	r4, r4, r7, lsl #16
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
 		movne	r3, r7, lsr #16
-USER(		ldrnet	r7, [r1], #4)			// May fault
+USER(		ldrnet	r7, [r1], #4)			@ May fault
 		orrne	r3, r3, r7, lsl #16
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
@@ -488,7 +488,7 @@
 		strb	r3, [r0], #1
 		movge	r3, r3, lsr #8
 		strgeb	r3, [r0], #1
-USER(		ldrgtbt	r3, [r1], #0)			// May fault
+USER(		ldrgtbt	r3, [r1], #0)			@ May fault
 		strgtb	r3, [r0], #1
 		b	.cfu_finished
 
@@ -496,7 +496,7 @@
 		addmi	ip, r2, #4
 		bmi	.cfu_3nowords
 		mov	r3, r7, lsr #24
-USER(		ldrt	r7, [r1], #4)			// May fault
+USER(		ldrt	r7, [r1], #4)			@ May fault
 		orr	r3, r3, r7, lsl #8
 		str	r3, [r0], #4
 		mov	ip, r1, lsl #32 - PAGE_SHIFT
@@ -510,7 +510,7 @@
 		blt	.cfu_3rem8lp
 
 .cfu_3cpy8lp:	mov	r3, r7, lsr #24
-		ldmia	r1!, {r4 - r7}			// Shouldn't fault
+		ldmia	r1!, {r4 - r7}			@ Shouldn't fault
 		orr	r3, r3, r4, lsl #8
 		mov	r4, r4, lsr #24
 		orr	r4, r4, r5, lsl #8
@@ -523,14 +523,14 @@
 		bpl	.cfu_3cpy8lp
 .cfu_3rem8lp:	tst	ip, #8
 		movne	r3, r7, lsr #24
-		ldmneia	r1!, {r4, r7}			// Shouldn't fault
+		ldmneia	r1!, {r4, r7}			@ Shouldn't fault
 		orrne	r3, r3, r4, lsl #8
 		movne	r4, r4, lsr #24
 		orrne	r4, r4, r7, lsl #8
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
 		movne	r3, r7, lsr #24
-USER(		ldrnet	r7, [r1], #4)			// May fault
+USER(		ldrnet	r7, [r1], #4)			@ May fault
 		orrne	r3, r3, r7, lsl #8
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
@@ -540,7 +540,7 @@
 		beq	.cfu_finished
 		cmp	ip, #2
 		strb	r3, [r0], #1
-USER(		ldrget	r3, [r1], #0)			// May fault
+USER(		ldrget	r3, [r1], #0)			@ May fault
 		strgeb	r3, [r0], #1
 		movgt	r3, r3, lsr #8
 		strgtb	r3, [r0], #1
@@ -553,7 +553,8 @@
 		   data was copied.  */
 9001:		ldr	r0, [sp], #4
 		ldr	r1, [sp]
-		bl	SYMBOL_NAME(memzero)
+		teq	r1, #0
+		blne	SYMBOL_NAME(__memzero)
 		LOADREGS(fd,sp!, {r0, r4 - r7, pc})
 		.previous
 #endif
@@ -597,19 +598,23 @@
 9001:		LOADREGS(fd,sp!, {r0, pc})
 		.previous
 
-/* Prototype: int __arch_strlen_user(char *str)
+/* Prototype: unsigned long __arch_strnlen_user(const char *str, long n)
  * Purpose  : get length of a string in user memory
  * Params   : str - address of string in user memory
- * Returns  : length of string *including terminator*, or zero on error
+ * Returns  : length of string *including terminator*
+ *	      or zero on exception, or n + 1 if too long
  */
-ENTRY(__arch_strlen_user)
+ENTRY(__arch_strnlen_user)
 		stmfd	sp!, {lr}
 		mov	r2, r0
 1:
-USER(		ldrbt	r1, [r0], #1)
-		teq	r1, #0
+USER(		ldrbt	r3, [r0], #1)
+		teq	r3, #0
+		beq	2f
+		subs	r1, r1, #1
 		bne	1b
-		sub	r0, r0, r2
+		add	r0, r0, #1
+2:		sub	r0, r0, r2
 		LOADREGS(fd,sp!, {pc})
 
 		.section .fixup,"ax"

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)