|
|
c6d234 |
commit 99f8dc922033821edcc13f9f8360e9fda40dfcff
|
|
|
c6d234 |
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
|
|
|
c6d234 |
Date: Thu Jul 3 01:28:45 2014 +0530
|
|
|
c6d234 |
|
|
|
c6d234 |
Fix -Wundef warning on PAGE_COPY_THRESHOLD
|
|
|
c6d234 |
|
|
|
c6d234 |
The PAGE_COPY_THRESHOLD macro is meant to be overridden by
|
|
|
c6d234 |
architecture-specific pagecopy.h, but it is currently done only by
|
|
|
c6d234 |
mach; all other architectures use the default. Check to see if the
|
|
|
c6d234 |
macro is defined in addition to whether it is set to a non-zero value.
|
|
|
c6d234 |
|
|
|
c6d234 |
Conflicts:
|
|
|
c6d234 |
sysdeps/generic/pagecopy.h
|
|
|
c6d234 |
|
|
|
c6d234 |
Due to copyright header change.
|
|
|
c6d234 |
|
|
|
c6d234 |
diff --git a/debug/memcpy_chk.c b/debug/memcpy_chk.c
|
|
|
c6d234 |
index bd43583ff4239c8a..4af85a8cb8f5c8de 100644
|
|
|
c6d234 |
--- a/debug/memcpy_chk.c
|
|
|
c6d234 |
+++ b/debug/memcpy_chk.c
|
|
|
c6d234 |
@@ -20,7 +20,6 @@
|
|
|
c6d234 |
|
|
|
c6d234 |
#include <string.h>
|
|
|
c6d234 |
#include <memcopy.h>
|
|
|
c6d234 |
-#include <pagecopy.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
void *
|
|
|
c6d234 |
__memcpy_chk (dstpp, srcpp, len, dstlen)
|
|
|
c6d234 |
diff --git a/debug/mempcpy_chk.c b/debug/mempcpy_chk.c
|
|
|
c6d234 |
index 8e26953764ff1b35..9a4f0e2fbcdde951 100644
|
|
|
c6d234 |
--- a/debug/mempcpy_chk.c
|
|
|
c6d234 |
+++ b/debug/mempcpy_chk.c
|
|
|
c6d234 |
@@ -21,7 +21,6 @@
|
|
|
c6d234 |
|
|
|
c6d234 |
#include <string.h>
|
|
|
c6d234 |
#include <memcopy.h>
|
|
|
c6d234 |
-#include <pagecopy.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
void *
|
|
|
c6d234 |
__mempcpy_chk (dstpp, srcpp, len, dstlen)
|
|
|
c6d234 |
diff --git a/string/memcpy.c b/string/memcpy.c
|
|
|
c6d234 |
index 3080fcb4de4cec83..fa1ec24eaca527c4 100644
|
|
|
c6d234 |
--- a/string/memcpy.c
|
|
|
c6d234 |
+++ b/string/memcpy.c
|
|
|
c6d234 |
@@ -20,7 +20,6 @@
|
|
|
c6d234 |
|
|
|
c6d234 |
#include <string.h>
|
|
|
c6d234 |
#include <memcopy.h>
|
|
|
c6d234 |
-#include <pagecopy.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
#undef memcpy
|
|
|
c6d234 |
|
|
|
c6d234 |
diff --git a/string/memmove.c b/string/memmove.c
|
|
|
c6d234 |
index c59e7a9c2a640f7d..51bff31c0530ba91 100644
|
|
|
c6d234 |
--- a/string/memmove.c
|
|
|
c6d234 |
+++ b/string/memmove.c
|
|
|
c6d234 |
@@ -20,7 +20,6 @@
|
|
|
c6d234 |
|
|
|
c6d234 |
#include <string.h>
|
|
|
c6d234 |
#include <memcopy.h>
|
|
|
c6d234 |
-#include <pagecopy.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
/* All this is so that bcopy.c can #include
|
|
|
c6d234 |
this file after defining some things. */
|
|
|
c6d234 |
diff --git a/sysdeps/generic/memcopy.h b/sysdeps/generic/memcopy.h
|
|
|
c6d234 |
index 08892a4ea33f1ca7..d0ffcd33b007ba38 100644
|
|
|
c6d234 |
--- a/sysdeps/generic/memcopy.h
|
|
|
c6d234 |
+++ b/sysdeps/generic/memcopy.h
|
|
|
c6d234 |
@@ -40,6 +40,7 @@
|
|
|
c6d234 |
|
|
|
c6d234 |
#include <sys/cdefs.h>
|
|
|
c6d234 |
#include <endian.h>
|
|
|
c6d234 |
+#include <pagecopy.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
/* The macros defined in this file are:
|
|
|
c6d234 |
|
|
|
c6d234 |
@@ -144,6 +145,47 @@ extern void _wordcopy_bwd_dest_aligned (long int, long int, size_t) __THROW;
|
|
|
c6d234 |
(nbytes_left) = (nbytes) % OPSIZ; \
|
|
|
c6d234 |
} while (0)
|
|
|
c6d234 |
|
|
|
c6d234 |
+/* The macro PAGE_COPY_FWD_MAYBE (dstp, srcp, nbytes_left, nbytes) is invoked
|
|
|
c6d234 |
+ like WORD_COPY_FWD et al. The pointers should be at least word aligned.
|
|
|
c6d234 |
+ This will check if virtual copying by pages can and should be done and do it
|
|
|
c6d234 |
+ if so. The pointers will be aligned to PAGE_SIZE bytes. The macro requires
|
|
|
c6d234 |
+ that pagecopy.h defines at least PAGE_COPY_THRESHOLD to 0. If
|
|
|
c6d234 |
+ PAGE_COPY_THRESHOLD is non-zero, the header must also define PAGE_COPY_FWD
|
|
|
c6d234 |
+ and PAGE_SIZE.
|
|
|
c6d234 |
+*/
|
|
|
c6d234 |
+#if PAGE_COPY_THRESHOLD
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+# include <assert.h>
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+# define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes) \
|
|
|
c6d234 |
+ do \
|
|
|
c6d234 |
+ { \
|
|
|
c6d234 |
+ if ((nbytes) >= PAGE_COPY_THRESHOLD && \
|
|
|
c6d234 |
+ PAGE_OFFSET ((dstp) - (srcp)) == 0) \
|
|
|
c6d234 |
+ { \
|
|
|
c6d234 |
+ /* The amount to copy is past the threshold for copying \
|
|
|
c6d234 |
+ pages virtually with kernel VM operations, and the \
|
|
|
c6d234 |
+ source and destination addresses have the same alignment. */ \
|
|
|
c6d234 |
+ size_t nbytes_before = PAGE_OFFSET (-(dstp)); \
|
|
|
c6d234 |
+ if (nbytes_before != 0) \
|
|
|
c6d234 |
+ { \
|
|
|
c6d234 |
+ /* First copy the words before the first page boundary. */ \
|
|
|
c6d234 |
+ WORD_COPY_FWD (dstp, srcp, nbytes_left, nbytes_before); \
|
|
|
c6d234 |
+ assert (nbytes_left == 0); \
|
|
|
c6d234 |
+ nbytes -= nbytes_before; \
|
|
|
c6d234 |
+ } \
|
|
|
c6d234 |
+ PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes); \
|
|
|
c6d234 |
+ } \
|
|
|
c6d234 |
+ } while (0)
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+/* The page size is always a power of two, so we can avoid modulo division. */
|
|
|
c6d234 |
+# define PAGE_OFFSET(n) ((n) & (PAGE_SIZE - 1))
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+#else
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+# define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes) /* nada */
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+#endif
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Threshold value for when to enter the unrolled loops. */
|
|
|
c6d234 |
#define OP_T_THRES 16
|
|
|
c6d234 |
diff --git a/sysdeps/generic/pagecopy.h b/sysdeps/generic/pagecopy.h
|
|
|
c6d234 |
index 89f392cb43c4dcbc..3c81de1b236486bf 100644
|
|
|
c6d234 |
--- a/sysdeps/generic/pagecopy.h
|
|
|
c6d234 |
+++ b/sysdeps/generic/pagecopy.h
|
|
|
c6d234 |
@@ -1,5 +1,5 @@
|
|
|
c6d234 |
-/* Macros for copying by pages; used in memcpy, memmove. Generic macros.
|
|
|
c6d234 |
- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
|
|
c6d234 |
+/* Macros for copying by pages; used in memcpy, memmove.
|
|
|
c6d234 |
+ Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
|
|
c6d234 |
This file is part of the GNU C Library.
|
|
|
c6d234 |
|
|
|
c6d234 |
The GNU C Library is free software; you can redistribute it and/or
|
|
|
c6d234 |
@@ -16,19 +16,15 @@
|
|
|
c6d234 |
License along with the GNU C Library; if not, see
|
|
|
c6d234 |
<http://www.gnu.org/licenses/>. */
|
|
|
c6d234 |
|
|
|
c6d234 |
-/* This file defines the macro:
|
|
|
c6d234 |
+/* The macro PAGE_COPY_FWD_MAYBE defined in memcopy.h is used in memmove if the
|
|
|
c6d234 |
+ PAGE_COPY_THRESHOLD macro is set to a non-zero value. The default is 0,
|
|
|
c6d234 |
+ that is copying by pages is not implemented.
|
|
|
c6d234 |
|
|
|
c6d234 |
- PAGE_COPY_FWD_MAYBE (dstp, srcp, nbytes_left, nbytes)
|
|
|
c6d234 |
-
|
|
|
c6d234 |
- which is invoked like WORD_COPY_FWD et al. The pointers should be at
|
|
|
c6d234 |
- least word aligned. This will check if virtual copying by pages can and
|
|
|
c6d234 |
- should be done and do it if so.
|
|
|
c6d234 |
-
|
|
|
c6d234 |
- System-specific pagecopy.h files should define these macros and then
|
|
|
c6d234 |
- #include this file:
|
|
|
c6d234 |
+ System-specific pagecopy.h files that want to support page copying should
|
|
|
c6d234 |
+ define these macros:
|
|
|
c6d234 |
|
|
|
c6d234 |
PAGE_COPY_THRESHOLD
|
|
|
c6d234 |
- -- Minimum size for which virtual copying by pages is worthwhile.
|
|
|
c6d234 |
+ -- A non-zero minimum size for which virtual copying by pages is worthwhile.
|
|
|
c6d234 |
|
|
|
c6d234 |
PAGE_SIZE
|
|
|
c6d234 |
-- Size of a page.
|
|
|
c6d234 |
@@ -38,37 +34,4 @@
|
|
|
c6d234 |
The pointers will be aligned to PAGE_SIZE bytes.
|
|
|
c6d234 |
*/
|
|
|
c6d234 |
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-#if PAGE_COPY_THRESHOLD
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-#include <assert.h>
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-#define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes) \
|
|
|
c6d234 |
- do \
|
|
|
c6d234 |
- { \
|
|
|
c6d234 |
- if ((nbytes) >= PAGE_COPY_THRESHOLD && \
|
|
|
c6d234 |
- PAGE_OFFSET ((dstp) - (srcp)) == 0) \
|
|
|
c6d234 |
- { \
|
|
|
c6d234 |
- /* The amount to copy is past the threshold for copying \
|
|
|
c6d234 |
- pages virtually with kernel VM operations, and the \
|
|
|
c6d234 |
- source and destination addresses have the same alignment. */ \
|
|
|
c6d234 |
- size_t nbytes_before = PAGE_OFFSET (-(dstp)); \
|
|
|
c6d234 |
- if (nbytes_before != 0) \
|
|
|
c6d234 |
- { \
|
|
|
c6d234 |
- /* First copy the words before the first page boundary. */ \
|
|
|
c6d234 |
- WORD_COPY_FWD (dstp, srcp, nbytes_left, nbytes_before); \
|
|
|
c6d234 |
- assert (nbytes_left == 0); \
|
|
|
c6d234 |
- nbytes -= nbytes_before; \
|
|
|
c6d234 |
- } \
|
|
|
c6d234 |
- PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes); \
|
|
|
c6d234 |
- } \
|
|
|
c6d234 |
- } while (0)
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-/* The page size is always a power of two, so we can avoid modulo division. */
|
|
|
c6d234 |
-#define PAGE_OFFSET(n) ((n) & (PAGE_SIZE - 1))
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-#else
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-#define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes) /* nada */
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-#endif
|
|
|
c6d234 |
+#define PAGE_COPY_THRESHOLD 0
|
|
|
c6d234 |
diff --git a/sysdeps/mach/pagecopy.h b/sysdeps/mach/pagecopy.h
|
|
|
c6d234 |
index 5b212144b7b163fe..8cce76a6d76698b9 100644
|
|
|
c6d234 |
--- a/sysdeps/mach/pagecopy.h
|
|
|
c6d234 |
+++ b/sysdeps/mach/pagecopy.h
|
|
|
c6d234 |
@@ -30,6 +30,3 @@
|
|
|
c6d234 |
(vm_address_t) dstp) == KERN_SUCCESS \
|
|
|
c6d234 |
? trunc_page (nbytes) \
|
|
|
c6d234 |
: 0)))
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-/* Get the generic macro. */
|
|
|
c6d234 |
-#include <sysdeps/generic/pagecopy.h>
|
|
|
c6d234 |
diff --git a/sysdeps/powerpc/memmove.c b/sysdeps/powerpc/memmove.c
|
|
|
c6d234 |
index 1617ecea95620133..50734e45458352c5 100644
|
|
|
c6d234 |
--- a/sysdeps/powerpc/memmove.c
|
|
|
c6d234 |
+++ b/sysdeps/powerpc/memmove.c
|
|
|
c6d234 |
@@ -20,7 +20,6 @@
|
|
|
c6d234 |
|
|
|
c6d234 |
#include <string.h>
|
|
|
c6d234 |
#include <memcopy.h>
|
|
|
c6d234 |
-#include <pagecopy.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
/* All this is so that bcopy.c can #include
|
|
|
c6d234 |
this file after defining some things. */
|