about summary refs log tree commit diff
path: root/sysdeps/generic/pagecopy.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-21 20:27:45 +0000
committerRoland McGrath <roland@gnu.org>1995-02-21 20:27:45 +0000
commitcaa8cd20fd1ef25a3989bb68ee2f4ffee78d8456 (patch)
tree1c5aaef96d08ea34b5e07a2ce3efdcb06f890cb8 /sysdeps/generic/pagecopy.h
parent6e583a6e115276860826c45e53cd038723ef0956 (diff)
downloadglibc-caa8cd20fd1ef25a3989bb68ee2f4ffee78d8456.tar.gz
glibc-caa8cd20fd1ef25a3989bb68ee2f4ffee78d8456.tar.xz
glibc-caa8cd20fd1ef25a3989bb68ee2f4ffee78d8456.zip
.
Diffstat (limited to 'sysdeps/generic/pagecopy.h')
-rw-r--r--sysdeps/generic/pagecopy.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/sysdeps/generic/pagecopy.h b/sysdeps/generic/pagecopy.h
index 07202a3119..66e1ac3aab 100644
--- a/sysdeps/generic/pagecopy.h
+++ b/sysdeps/generic/pagecopy.h
@@ -42,25 +42,26 @@ Cambridge, MA 02139, USA.  */
 
 #if PAGE_COPY_THRESHOLD
 
+#include <assert.h>
+
 #define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes)		      \
   do									      \
     {									      \
       if ((nbytes) >= PAGE_COPY_THRESHOLD &&				      \
-	  PAGE_OFFSET (dstp) == PAGE_OFFSET (srcp))			      \
+	  PAGE_OFFSET ((dstp) - (srcp)) == 0) 				      \
 	{								      \
 	  /* The amount to copy is past the threshold for copying	      \
 	     pages virtually with kernel VM operations, and the		      \
 	     source and destination addresses have the same alignment.  */    \
-	  size_t nbytes_before = PAGE_OFFSET (PAGE_SIZE - PAGE_OFFSET (dstp));\
+	  size_t nbytes_before = PAGE_OFFSET (-(dstp));			      \
 	  if (nbytes_before != 0)					      \
 	    {								      \
 	      /* First copy the words before the first page boundary.  */     \
 	      WORD_COPY_FWD (dstp, srcp, nbytes_left, nbytes_before);	      \
-	      nbytes_before -= nbytes_left;				      \
+	      assert (nbytes_left == 0);				      \
 	      nbytes -= nbytes_before;					      \
 	    }								      \
-	  if (nbytes_before == 0)					      \
-	    PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes);		      \
+	  PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes);		      \
 	}								      \
     } while (0)