[PATCH] [3/4] PPC64: PAGE_SIZE constants in copyuser.S and copypage.S

Olof Johansson olof at lixom.net
Wed Aug 10 06:23:30 EST 2005


Replace some of the hardcoded constants in copypage and copyuser to
be based on PAGE_SIZE. Also change the assembly where needed to deal
with larger values of PAGE_SIZE.

Signed-off-by: Olof Johansson <olof at lixom.net>


Index: gr_work/arch/ppc64/lib/copypage.S
===================================================================
--- gr_work.orig/arch/ppc64/lib/copypage.S	2005-08-08 13:58:53.876635495 -0500
+++ gr_work/arch/ppc64/lib/copypage.S	2005-08-08 14:01:35.414604998 -0500
@@ -24,7 +24,7 @@ _GLOBAL(copy_page)
 	std	r22,-80(1)
 	std	r21,-88(1)
 	std	r20,-96(1)
-	li	r5,4096/32 - 1
+	li	r5,PAGE_SIZE/32 - 1
 	addi	r3,r3,-8
 	li	r12,5
 0:	addi	r5,r5,-24
Index: gr_work/arch/ppc64/lib/copyuser.S
===================================================================
--- gr_work.orig/arch/ppc64/lib/copyuser.S	2005-08-08 13:58:53.877635336 -0500
+++ gr_work/arch/ppc64/lib/copyuser.S	2005-08-08 14:18:19.126545435 -0500
@@ -15,10 +15,16 @@
 _GLOBAL(__copy_tofrom_user)
 	/* first check for a whole page copy on a page boundary */
 	cmpldi	cr1,r5,16
-	cmpdi	cr6,r5,4096
+#if PAGE_SIZE > 0x8000
+	li	r6,PAGE_SIZE at l
+	oris	r6,r6,PAGE_SIZE at h
+	cmpd	cr6,r5,r6
+#else
+	cmpdi	cr6,r5,PAGE_SIZE
+#endif
 	or	r0,r3,r4
 	neg	r6,r3		/* LS 3 bits = # bytes to 8-byte dest bdry */
-	andi.	r0,r0,4095
+	andi.	r0,r0,PAGE_SIZE-1
 	std	r3,-24(r1)
 	crand	cr0*4+2,cr0*4+2,cr6*4+2
 	std	r4,-16(r1)
@@ -379,7 +385,7 @@ _GLOBAL(__copy_tofrom_user)
 	std	r22,-104(1)
 	std	r21,-112(1)
 	std	r20,-120(1)
-	li	r5,4096/32 - 1
+	li	r5,PAGE_SIZE/32 - 1
 	addi	r3,r3,-8
 	li	r0,5
 0:	addi	r5,r5,-24
@@ -497,7 +503,10 @@ _GLOBAL(__copy_tofrom_user)
 	ld	r31,-32(1)
 	ld	r3,-24(r1)
 	ld	r4,-16(r1)
-	li	r5,4096
+	li	r5,PAGE_SIZE at l
+#if PAGE_SIZE > 0x8000
+	oris	r5,r5,PAGE_SIZE at h
+#endif
 	b	.Ldst_aligned
 
 	.section __ex_table,"a"



More information about the Linuxppc64-dev mailing list