2007-05-21 21:21:48 +02:00
|
|
|
/*
|
|
|
|
Optimized memcpy for x86-64.
|
|
|
|
|
2014-01-01 12:03:15 +01:00
|
|
|
Copyright (C) 2007-2014 Free Software Foundation, Inc.
|
2007-05-21 21:21:48 +02:00
|
|
|
Contributed by Evandro Menezes <evandro.menezes@amd.com>, 2007.
|
|
|
|
|
2002-08-31 19:45:33 +02:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-10 00:18:22 +01:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>.
|
2007-05-21 21:21:48 +02:00
|
|
|
*/
|
2002-08-31 19:45:33 +02:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
#include "asm-syntax.h"
|
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
/* Stack slots in the red-zone. */
|
|
|
|
|
|
|
|
#ifdef USE_AS_MEMPCPY
|
|
|
|
# define RETVAL (0)
|
|
|
|
#else
|
|
|
|
# define RETVAL (-8)
|
2011-04-02 01:38:21 +02:00
|
|
|
# if defined SHARED && !defined USE_MULTIARCH && !defined NOT_IN_libc
|
|
|
|
# define memcpy __memcpy
|
|
|
|
# undef libc_hidden_builtin_def
|
|
|
|
# define libc_hidden_builtin_def(name) \
|
|
|
|
.globl __GI_memcpy; __GI_memcpy = __memcpy
|
|
|
|
# endif
|
2007-05-21 21:21:48 +02:00
|
|
|
#endif
|
|
|
|
#define SAVE0 (RETVAL - 8)
|
|
|
|
#define SAVE1 (SAVE0 - 8)
|
|
|
|
#define SAVE2 (SAVE1 - 8)
|
|
|
|
#define SAVE3 (SAVE2 - 8)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
|
|
|
.text
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-18 06:17:19 +02:00
|
|
|
#if defined PIC && !defined NOT_IN_libc
|
2010-06-30 17:26:11 +02:00
|
|
|
ENTRY_CHK (__memcpy_chk)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-18 06:17:19 +02:00
|
|
|
cmpq %rdx, %rcx
|
|
|
|
jb HIDDEN_JUMPTARGET (__chk_fail)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2010-06-30 17:26:11 +02:00
|
|
|
END_CHK (__memcpy_chk)
|
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-18 06:17:19 +02:00
|
|
|
#endif
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
ENTRY(memcpy) /* (void *, const void*, size_t) */
|
|
|
|
|
|
|
|
/* Handle tiny blocks. */
|
|
|
|
|
|
|
|
L(1try): /* up to 32B */
|
2002-08-31 19:45:33 +02:00
|
|
|
cmpq $32, %rdx
|
2007-05-21 21:21:48 +02:00
|
|
|
#ifndef USE_AS_MEMPCPY
|
|
|
|
movq %rdi, %rax /* save return value */
|
2002-08-31 19:45:33 +02:00
|
|
|
#endif
|
2007-05-21 21:21:48 +02:00
|
|
|
jae L(1after)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
L(1): /* 1-byte once */
|
|
|
|
testb $1, %dl
|
|
|
|
jz L(1a)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
movzbl (%rsi), %ecx
|
|
|
|
movb %cl, (%rdi)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
incq %rsi
|
|
|
|
incq %rdi
|
|
|
|
|
|
|
|
.p2align 4,, 4
|
|
|
|
|
|
|
|
L(1a): /* 2-byte once */
|
|
|
|
testb $2, %dl
|
|
|
|
jz L(1b)
|
|
|
|
|
|
|
|
movzwl (%rsi), %ecx
|
|
|
|
movw %cx, (%rdi)
|
|
|
|
|
|
|
|
addq $2, %rsi
|
|
|
|
addq $2, %rdi
|
|
|
|
|
|
|
|
.p2align 4,, 4
|
|
|
|
|
|
|
|
L(1b): /* 4-byte once */
|
|
|
|
testb $4, %dl
|
|
|
|
jz L(1c)
|
|
|
|
|
|
|
|
movl (%rsi), %ecx
|
|
|
|
movl %ecx, (%rdi)
|
|
|
|
|
|
|
|
addq $4, %rsi
|
|
|
|
addq $4, %rdi
|
|
|
|
|
|
|
|
.p2align 4,, 4
|
|
|
|
|
|
|
|
L(1c): /* 8-byte once */
|
|
|
|
testb $8, %dl
|
|
|
|
jz L(1d)
|
|
|
|
|
|
|
|
movq (%rsi), %rcx
|
|
|
|
movq %rcx, (%rdi)
|
|
|
|
|
|
|
|
addq $8, %rsi
|
|
|
|
addq $8, %rdi
|
|
|
|
|
|
|
|
.p2align 4,, 4
|
|
|
|
|
|
|
|
L(1d): /* 16-byte loop */
|
|
|
|
andl $0xf0, %edx
|
|
|
|
jz L(exit)
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(1loop):
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rcx
|
|
|
|
movq 8(%rsi), %r8
|
|
|
|
movq %rcx, (%rdi)
|
|
|
|
movq %r8, 8(%rdi)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
subl $16, %edx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
leaq 16(%rsi), %rsi
|
|
|
|
leaq 16(%rdi), %rdi
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
jnz L(1loop)
|
|
|
|
|
|
|
|
.p2align 4,, 4
|
|
|
|
|
|
|
|
L(exit): /* exit */
|
|
|
|
#ifdef USE_AS_MEMPCPY
|
|
|
|
movq %rdi, %rax /* return value */
|
|
|
|
#else
|
|
|
|
rep
|
|
|
|
#endif
|
|
|
|
retq
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(1after):
|
|
|
|
#ifndef USE_AS_MEMPCPY
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %rax, RETVAL(%rsp) /* save return value */
|
2007-05-21 21:21:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Align to the natural word size. */
|
|
|
|
|
|
|
|
L(aligntry):
|
2007-09-22 07:54:03 +02:00
|
|
|
movl %esi, %ecx /* align by source */
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
andl $7, %ecx
|
|
|
|
jz L(alignafter) /* already aligned */
|
|
|
|
|
|
|
|
L(align): /* align */
|
2007-09-22 07:54:03 +02:00
|
|
|
leaq -8(%rcx, %rdx), %rdx /* calculate remaining bytes */
|
2007-05-21 21:21:48 +02:00
|
|
|
subl $8, %ecx
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(alignloop): /* 1-byte alignment loop */
|
|
|
|
movzbl (%rsi), %eax
|
|
|
|
movb %al, (%rdi)
|
|
|
|
|
|
|
|
incl %ecx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
leaq 1(%rsi), %rsi
|
|
|
|
leaq 1(%rdi), %rdi
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
jnz L(alignloop)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(alignafter):
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
/* Handle mid-sized blocks. */
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
L(32try): /* up to 1KB */
|
|
|
|
cmpq $1024, %rdx
|
|
|
|
ja L(32after)
|
|
|
|
|
|
|
|
L(32): /* 32-byte loop */
|
|
|
|
movl %edx, %ecx
|
|
|
|
shrl $5, %ecx
|
|
|
|
jz L(32skip)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
L(32loop):
|
|
|
|
decl %ecx
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8(%rsi), %r8
|
|
|
|
movq 16(%rsi), %r9
|
|
|
|
movq 24(%rsi), %r10
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %rax, (%rdi)
|
|
|
|
movq %r8, 8(%rdi)
|
|
|
|
movq %r9, 16(%rdi)
|
|
|
|
movq %r10, 24(%rdi)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
|
|
|
leaq 32(%rsi), %rsi
|
|
|
|
leaq 32(%rdi), %rdi
|
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
jz L(32skip) /* help out smaller blocks */
|
|
|
|
|
|
|
|
decl %ecx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8(%rsi), %r8
|
|
|
|
movq 16(%rsi), %r9
|
|
|
|
movq 24(%rsi), %r10
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %rax, (%rdi)
|
|
|
|
movq %r8, 8(%rdi)
|
|
|
|
movq %r9, 16(%rdi)
|
|
|
|
movq %r10, 24(%rdi)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
leaq 32(%rsi), %rsi
|
|
|
|
leaq 32(%rdi), %rdi
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
jnz L(32loop)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(32skip):
|
|
|
|
andl $31, %edx /* check for left overs */
|
|
|
|
#ifdef USE_AS_MEMPCPY
|
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
movq %rdi, %rax
|
2002-08-31 19:45:33 +02:00
|
|
|
#else
|
2007-09-22 07:54:03 +02:00
|
|
|
movq RETVAL(%rsp), %rax
|
2007-05-21 21:21:48 +02:00
|
|
|
jnz L(1)
|
2007-09-22 07:54:03 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
rep
|
|
|
|
#endif
|
|
|
|
retq /* exit */
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(32after):
|
|
|
|
|
|
|
|
/*
|
|
|
|
In order to minimize code-size in RTLD, algorithms specific for
|
|
|
|
larger blocks are excluded when building for RTLD.
|
|
|
|
*/
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
/* Handle blocks smaller than 1/2 L1. */
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
L(fasttry): /* first 1/2 L1 */
|
|
|
|
#ifndef NOT_IN_libc /* only up to this algorithm outside of libc.so */
|
2013-01-06 01:00:38 +01:00
|
|
|
mov __x86_data_cache_size_half(%rip), %R11_LP
|
2007-05-21 21:21:48 +02:00
|
|
|
cmpq %rdx, %r11 /* calculate the smaller of */
|
|
|
|
cmovaq %rdx, %r11 /* remaining bytes and 1/2 L1 */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
L(fast): /* good ol' MOVS */
|
|
|
|
#ifndef NOT_IN_libc
|
|
|
|
movq %r11, %rcx
|
|
|
|
andq $-8, %r11
|
|
|
|
#else
|
|
|
|
movq %rdx, %rcx
|
|
|
|
#endif
|
|
|
|
shrq $3, %rcx
|
|
|
|
jz L(fastskip)
|
|
|
|
|
|
|
|
rep
|
|
|
|
movsq
|
|
|
|
|
|
|
|
.p2align 4,, 4
|
|
|
|
|
|
|
|
L(fastskip):
|
|
|
|
#ifndef NOT_IN_libc
|
|
|
|
subq %r11, %rdx /* check for more */
|
|
|
|
testq $-8, %rdx
|
|
|
|
jnz L(fastafter)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
andl $7, %edx /* check for left overs */
|
|
|
|
#ifdef USE_AS_MEMPCPY
|
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
movq %rdi, %rax
|
|
|
|
#else
|
2007-09-22 07:54:03 +02:00
|
|
|
movq RETVAL(%rsp), %rax
|
2007-05-21 21:21:48 +02:00
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
rep
|
|
|
|
#endif
|
|
|
|
retq /* exit */
|
|
|
|
|
|
|
|
#ifndef NOT_IN_libc /* none of the algorithms below for RTLD */
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(fastafter):
|
|
|
|
|
|
|
|
/* Handle large blocks smaller than 1/2 L2. */
|
|
|
|
|
|
|
|
L(pretry): /* first 1/2 L2 */
|
2013-01-06 01:00:38 +01:00
|
|
|
mov __x86_shared_cache_size_half (%rip), %R8_LP
|
2007-05-21 21:21:48 +02:00
|
|
|
cmpq %rdx, %r8 /* calculate the lesser of */
|
|
|
|
cmovaq %rdx, %r8 /* remaining bytes and 1/2 L2 */
|
|
|
|
|
|
|
|
L(pre): /* 64-byte with prefetching */
|
|
|
|
movq %r8, %rcx
|
|
|
|
andq $-64, %r8
|
|
|
|
shrq $6, %rcx
|
|
|
|
jz L(preskip)
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %r14, SAVE0(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%r14, SAVE0)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %r13, SAVE1(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%r13, SAVE1)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %r12, SAVE2(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%r12, SAVE2)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %rbx, SAVE3(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%rbx, SAVE3)
|
|
|
|
|
2013-01-06 01:00:38 +01:00
|
|
|
cmpl $0, __x86_prefetchw(%rip)
|
2007-05-21 21:21:48 +02:00
|
|
|
jz L(preloop) /* check if PREFETCHW OK */
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
/* ... when PREFETCHW is available (less cache-probe traffic in MP systems). */
|
|
|
|
|
|
|
|
L(prewloop): /* cache-line in state M */
|
|
|
|
decq %rcx
|
|
|
|
|
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8 (%rsi), %rbx
|
|
|
|
movq 16 (%rsi), %r9
|
|
|
|
movq 24 (%rsi), %r10
|
|
|
|
movq 32 (%rsi), %r11
|
|
|
|
movq 40 (%rsi), %r12
|
|
|
|
movq 48 (%rsi), %r13
|
|
|
|
movq 56 (%rsi), %r14
|
|
|
|
|
|
|
|
prefetcht0 0 + 896 (%rsi)
|
|
|
|
prefetcht0 64 + 896 (%rsi)
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %rax, (%rdi)
|
|
|
|
movq %rbx, 8(%rdi)
|
|
|
|
movq %r9, 16(%rdi)
|
|
|
|
movq %r10, 24(%rdi)
|
|
|
|
movq %r11, 32(%rdi)
|
|
|
|
movq %r12, 40(%rdi)
|
|
|
|
movq %r13, 48(%rdi)
|
|
|
|
movq %r14, 56(%rdi)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
leaq 64(%rsi), %rsi
|
|
|
|
leaq 64(%rdi), %rdi
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
jz L(prebail)
|
|
|
|
|
|
|
|
decq %rcx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8(%rsi), %rbx
|
|
|
|
movq 16(%rsi), %r9
|
|
|
|
movq 24(%rsi), %r10
|
|
|
|
movq 32(%rsi), %r11
|
|
|
|
movq 40(%rsi), %r12
|
|
|
|
movq 48(%rsi), %r13
|
|
|
|
movq 56(%rsi), %r14
|
|
|
|
|
|
|
|
movq %rax, (%rdi)
|
|
|
|
movq %rbx, 8(%rdi)
|
|
|
|
movq %r9, 16(%rdi)
|
|
|
|
movq %r10, 24(%rdi)
|
|
|
|
movq %r11, 32(%rdi)
|
|
|
|
movq %r12, 40(%rdi)
|
|
|
|
movq %r13, 48(%rdi)
|
|
|
|
movq %r14, 56(%rdi)
|
|
|
|
|
|
|
|
prefetchw 896 - 64(%rdi)
|
|
|
|
prefetchw 896 - 0(%rdi)
|
|
|
|
|
|
|
|
leaq 64(%rsi), %rsi
|
|
|
|
leaq 64(%rdi), %rdi
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
jnz L(prewloop)
|
|
|
|
jmp L(prebail)
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
/* ... when PREFETCHW is not available. */
|
|
|
|
|
|
|
|
L(preloop): /* cache-line in state E */
|
|
|
|
decq %rcx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8(%rsi), %rbx
|
|
|
|
movq 16(%rsi), %r9
|
|
|
|
movq 24(%rsi), %r10
|
|
|
|
movq 32(%rsi), %r11
|
|
|
|
movq 40(%rsi), %r12
|
|
|
|
movq 48(%rsi), %r13
|
|
|
|
movq 56(%rsi), %r14
|
|
|
|
|
|
|
|
prefetcht0 896 + 0(%rsi)
|
|
|
|
prefetcht0 896 + 64(%rsi)
|
|
|
|
|
|
|
|
movq %rax, (%rdi)
|
|
|
|
movq %rbx, 8(%rdi)
|
|
|
|
movq %r9, 16(%rdi)
|
|
|
|
movq %r10, 24(%rdi)
|
|
|
|
movq %r11, 32(%rdi)
|
|
|
|
movq %r12, 40(%rdi)
|
|
|
|
movq %r13, 48(%rdi)
|
|
|
|
movq %r14, 56(%rdi)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
leaq 64 (%rsi), %rsi
|
|
|
|
leaq 64 (%rdi), %rdi
|
|
|
|
|
|
|
|
jz L(prebail)
|
|
|
|
|
|
|
|
decq %rcx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8(%rsi), %rbx
|
|
|
|
movq 16(%rsi), %r9
|
|
|
|
movq 24(%rsi), %r10
|
|
|
|
movq 32(%rsi), %r11
|
|
|
|
movq 40(%rsi), %r12
|
|
|
|
movq 48(%rsi), %r13
|
|
|
|
movq 56(%rsi), %r14
|
|
|
|
|
|
|
|
prefetcht0 896 - 64(%rdi)
|
|
|
|
prefetcht0 896 - 0(%rdi)
|
|
|
|
|
|
|
|
movq %rax, (%rdi)
|
|
|
|
movq %rbx, 8(%rdi)
|
|
|
|
movq %r9, 16(%rdi)
|
|
|
|
movq %r10, 24(%rdi)
|
|
|
|
movq %r11, 32(%rdi)
|
|
|
|
movq %r12, 40(%rdi)
|
|
|
|
movq %r13, 48(%rdi)
|
|
|
|
movq %r14, 56(%rdi)
|
|
|
|
|
|
|
|
leaq 64(%rsi), %rsi
|
|
|
|
leaq 64(%rdi), %rdi
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
jnz L(preloop)
|
|
|
|
|
|
|
|
L(prebail):
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE3(%rsp), %rbx
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%rbx)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE2(%rsp), %r12
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%r12)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE1(%rsp), %r13
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%r13)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE0(%rsp), %r14
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%r14)
|
|
|
|
|
|
|
|
/* .p2align 4 */
|
|
|
|
|
|
|
|
L(preskip):
|
|
|
|
subq %r8, %rdx /* check for more */
|
|
|
|
testq $-64, %rdx
|
|
|
|
jnz L(preafter)
|
|
|
|
|
|
|
|
andl $63, %edx /* check for left overs */
|
|
|
|
#ifdef USE_AS_MEMPCPY
|
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
movq %rdi, %rax
|
|
|
|
#else
|
2007-09-22 07:54:03 +02:00
|
|
|
movq RETVAL(%rsp), %rax
|
2007-05-21 21:21:48 +02:00
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
rep
|
|
|
|
#endif
|
|
|
|
retq /* exit */
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(preafter):
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
/* Handle huge blocks. */
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
L(NTtry):
|
|
|
|
|
|
|
|
L(NT): /* non-temporal 128-byte */
|
|
|
|
movq %rdx, %rcx
|
|
|
|
shrq $7, %rcx
|
|
|
|
jz L(NTskip)
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %r14, SAVE0(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%r14, SAVE0)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %r13, SAVE1(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%r13, SAVE1)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq %r12, SAVE2(%rsp)
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_rel_offset (%r12, SAVE2)
|
|
|
|
|
|
|
|
.p2align 4
|
|
|
|
|
|
|
|
L(NTloop):
|
2007-09-22 07:54:03 +02:00
|
|
|
prefetchnta 768(%rsi)
|
|
|
|
prefetchnta 832(%rsi)
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
decq %rcx
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq (%rsi), %rax
|
|
|
|
movq 8(%rsi), %r8
|
|
|
|
movq 16(%rsi), %r9
|
|
|
|
movq 24(%rsi), %r10
|
|
|
|
movq 32(%rsi), %r11
|
|
|
|
movq 40(%rsi), %r12
|
|
|
|
movq 48(%rsi), %r13
|
|
|
|
movq 56(%rsi), %r14
|
|
|
|
|
|
|
|
movntiq %rax, (%rdi)
|
|
|
|
movntiq %r8, 8(%rdi)
|
|
|
|
movntiq %r9, 16(%rdi)
|
|
|
|
movntiq %r10, 24(%rdi)
|
|
|
|
movntiq %r11, 32(%rdi)
|
|
|
|
movntiq %r12, 40(%rdi)
|
|
|
|
movntiq %r13, 48(%rdi)
|
|
|
|
movntiq %r14, 56(%rdi)
|
|
|
|
|
|
|
|
movq 64(%rsi), %rax
|
|
|
|
movq 72(%rsi), %r8
|
|
|
|
movq 80(%rsi), %r9
|
|
|
|
movq 88(%rsi), %r10
|
|
|
|
movq 96(%rsi), %r11
|
|
|
|
movq 104(%rsi), %r12
|
|
|
|
movq 112(%rsi), %r13
|
|
|
|
movq 120(%rsi), %r14
|
|
|
|
|
|
|
|
movntiq %rax, 64(%rdi)
|
|
|
|
movntiq %r8, 72(%rdi)
|
|
|
|
movntiq %r9, 80(%rdi)
|
|
|
|
movntiq %r10, 88(%rdi)
|
|
|
|
movntiq %r11, 96(%rdi)
|
|
|
|
movntiq %r12, 104(%rdi)
|
|
|
|
movntiq %r13, 112(%rdi)
|
|
|
|
movntiq %r14, 120(%rdi)
|
|
|
|
|
|
|
|
leaq 128(%rsi), %rsi
|
|
|
|
leaq 128(%rdi), %rdi
|
2007-05-21 21:21:48 +02:00
|
|
|
|
|
|
|
jnz L(NTloop)
|
|
|
|
|
|
|
|
sfence /* serialize memory stores */
|
|
|
|
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE2(%rsp), %r12
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%r12)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE1(%rsp), %r13
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%r13)
|
2007-09-22 07:54:03 +02:00
|
|
|
movq SAVE0(%rsp), %r14
|
2007-05-21 21:21:48 +02:00
|
|
|
cfi_restore (%r14)
|
|
|
|
|
|
|
|
L(NTskip):
|
|
|
|
andl $127, %edx /* check for left overs */
|
|
|
|
#ifdef USE_AS_MEMPCPY
|
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
movq %rdi, %rax
|
|
|
|
#else
|
2007-09-22 07:54:03 +02:00
|
|
|
movq RETVAL(%rsp), %rax
|
2007-05-21 21:21:48 +02:00
|
|
|
jnz L(1)
|
|
|
|
|
|
|
|
rep
|
2002-08-31 19:45:33 +02:00
|
|
|
#endif
|
2007-05-21 21:21:48 +02:00
|
|
|
retq /* exit */
|
|
|
|
|
|
|
|
#endif /* !NOT_IN_libc */
|
|
|
|
|
|
|
|
END(memcpy)
|
2002-08-31 19:45:33 +02:00
|
|
|
|
2007-05-21 21:21:48 +02:00
|
|
|
#ifndef USE_AS_MEMPCPY
|
Update.
* sysdeps/i386/fpu/ftestexcept.c: Also check SSE status word.
* include/signal.h: Use libc_hidden_proto for sigaddset and sigdelset.
* signal/sigaddset.c: Add libc_hidden_def.
* signal/sigdelset.c: Likewise.
2003-04-29 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/i486/string-inlines.c (__memcpy_g, __strchr_g): Move
to the end of the file.
* configure.in: Change __oline__ to $LINENO.
(HAVE_BUILTIN_REDIRECTION): New check.
* config.h.in (HAVE_BUILTIN_REDIRECTION): Add.
* include/libc-symbols.h (libc_hidden_builtin_proto,
libc_hidden_builtin_def, libc_hidden_builtin_weak,
libc_hidden_builtin_ver): Define.
* include/string.h (memchr, memcpy, memmove, memset, strcat, strchr,
strcmp, strcpy, strcspn, strlen, strncmp, strncpy, strpbrk, strrchr,
strspn, strstr): Add libc_hidden_builtin_proto.
* intl/plural.y: Include string.h.
* sysdeps/alpha/alphaev6/memchr.S (memchr): Add
libc_hidden_builtin_def.
* sysdeps/alpha/alphaev6/memcpy.S (memcpy): Likewise.
* sysdeps/alpha/alphaev6/memset.S (memset): Likewise.
* sysdeps/alpha/alphaev67/strcat.S (strcat): Likewise.
* sysdeps/alpha/alphaev67/strchr.S (strchr): Likewise.
* sysdeps/alpha/alphaev67/strlen.S (strlen): Likewise.
* sysdeps/alpha/alphaev67/strrchr.S (strrchr): Likewise.
* sysdeps/alpha/memchr.S (memchr): Likewise.
* sysdeps/alpha/memset.S (memset): Likewise.
* sysdeps/alpha/strcat.S (strcat): Likewise.
* sysdeps/alpha/strchr.S (strchr): Likewise.
* sysdeps/alpha/strcmp.S (strcmp): Likewise.
* sysdeps/alpha/strcpy.S (strcpy): Likewise.
* sysdeps/alpha/strlen.S (strlen): Likewise.
* sysdeps/alpha/strncmp.S (strncmp): Likewise.
* sysdeps/alpha/strncpy.S (strncpy): Likewise.
* sysdeps/alpha/strrchr.S (strrchr): Likewise.
* sysdeps/arm/memset.S (memset): Likewise.
* sysdeps/arm/strlen.S (strlen): Likewise.
* sysdeps/generic/memchr.c (memchr): Likewise.
* sysdeps/generic/memcpy.c (memcpy): Likewise.
* sysdeps/generic/memmove.c (memmove): Likewise.
* sysdeps/generic/memset.c (memset): Likewise.
* sysdeps/generic/strcat.c (strcat): Likewise.
* sysdeps/generic/strchr.c (strchr): Likewise.
* sysdeps/generic/strcmp.c (strcmp): Likewise.
* sysdeps/generic/strcpy.c (strcpy): Likewise.
* sysdeps/generic/strcspn.c (strcspn): Likewise.
* sysdeps/generic/strlen.c (strlen): Likewise.
* sysdeps/generic/strncmp.c (strncmp): Likewise.
* sysdeps/generic/strncpy.c (strncpy): Likewise.
* sysdeps/generic/strpbrk.c (strpbrk): Likewise.
* sysdeps/generic/strrchr.c (strrchr): Likewise.
* sysdeps/generic/strspn.c (strspn): Likewise.
* sysdeps/generic/strstr.c (strstr): Likewise.
* sysdeps/i386/i486/strcat.S (strcat): Likewise.
* sysdeps/i386/i486/strlen.S (strlen): Likewise.
* sysdeps/i386/i586/memcpy.S (memcpy): Likewise.
* sysdeps/i386/i586/memset.S (memset): Likewise.
* sysdeps/i386/i586/strchr.S (strchr): Likewise.
* sysdeps/i386/i586/strcpy.S (strcpy): Likewise.
* sysdeps/i386/i586/strlen.S (strlen): Likewise.
* sysdeps/i386/i686/memcpy.S (memcpy): Likewise.
* sysdeps/i386/i686/memmove.S (memmove): Likewise.
* sysdeps/i386/i686/memset.S (memset): Likewise.
* sysdeps/i386/i686/strcmp.S (strcmp): Likewise.
* sysdeps/i386/memchr.S (memchr): Likewise.
* sysdeps/i386/memset.c (memset): Likewise.
* sysdeps/i386/strchr.S (strchr): Likewise.
* sysdeps/i386/strcspn.S (strcspn): Likewise.
* sysdeps/i386/strlen.c (strlen): Likewise.
* sysdeps/i386/strpbrk.S (strpbrk): Likewise.
* sysdeps/i386/strrchr.S (strrchr): Likewise.
* sysdeps/i386/strspn.S (strspn): Likewise.
* sysdeps/ia64/memchr.S (memchr): Likewise.
* sysdeps/ia64/memcpy.S (memcpy): Likewise.
* sysdeps/ia64/memmove.S (memmove): Likewise.
* sysdeps/ia64/memset.S (memset): Likewise.
* sysdeps/ia64/strcat.S (strcat): Likewise.
* sysdeps/ia64/strchr.S (strchr): Likewise.
* sysdeps/ia64/strcmp.S (strcmp): Likewise.
* sysdeps/ia64/strcpy.S (strcpy): Likewise.
* sysdeps/ia64/strlen.S (strlen): Likewise.
* sysdeps/ia64/strncmp.S (strncmp): Likewise.
* sysdeps/ia64/strncpy.S (strncpy): Likewise.
* sysdeps/m68k/memchr.S (memchr): Likewise.
* sysdeps/m68k/strchr.S (strchr): Likewise.
* sysdeps/mips/mips64/memcpy.S (memcpy): Likewise.
* sysdeps/mips/mips64/memset.S (memset): Likewise.
* sysdeps/mips/memcpy.S (memcpy): Likewise.
* sysdeps/mips/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc32/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc32/strchr.S (strchr): Likewise.
* sysdeps/powerpc/powerpc32/strcmp.S (strcmp): Likewise.
* sysdeps/powerpc/powerpc32/strcpy.S (strcpy): Likewise.
* sysdeps/powerpc/powerpc32/strlen.S (strlen): Likewise.
* sysdeps/powerpc/powerpc64/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc64/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc64/strchr.S (strchr): Likewise.
* sysdeps/powerpc/powerpc64/strcmp.S (strcmp): Likewise.
* sysdeps/powerpc/powerpc64/strcpy.S (strcpy): Likewise.
* sysdeps/powerpc/powerpc64/strlen.S (strlen): Likewise.
* sysdeps/powerpc/strcat.c (strcat): Likewise.
* sysdeps/sparc/sparc32/memchr.S (memchr): Likewise.
* sysdeps/sparc/sparc32/memcpy.S (memcpy): Likewise.
* sysdeps/sparc/sparc32/memset.S (memset): Likewise.
* sysdeps/sparc/sparc32/strcat.S (strcat): Likewise.
* sysdeps/sparc/sparc32/strchr.S (strchr, strrchr): Likewise.
* sysdeps/sparc/sparc32/strcmp.S (strcmp): Likewise.
* sysdeps/sparc/sparc32/strcpy.S (strcpy): Likewise.
* sysdeps/sparc/sparc32/strlen.S (strlen): Likewise.
* sysdeps/sparc/sparc64/sparcv9b/memcpy.S (memcpy, memmove): Likewise.
* sysdeps/sparc/sparc64/memchr.S (memchr): Likewise.
* sysdeps/sparc/sparc64/memcpy.S (memcpy, memmove): Likewise.
* sysdeps/sparc/sparc64/memset.S (memset): Likewise.
* sysdeps/sparc/sparc64/strcat.S (strcat): Likewise.
* sysdeps/sparc/sparc64/strchr.S (strchr, strrchr): Likewise.
* sysdeps/sparc/sparc64/strcmp.S (strcmp): Likewise.
* sysdeps/sparc/sparc64/strcpy.S (strcpy): Likewise.
* sysdeps/sparc/sparc64/strcspn.S (strcspn): Likewise.
* sysdeps/sparc/sparc64/strlen.S (strlen): Likewise.
* sysdeps/sparc/sparc64/strncmp.S (strncmp): Likewise.
* sysdeps/sparc/sparc64/strncpy.S (strncpy): Likewise.
* sysdeps/sparc/sparc64/strpbrk.S (strpbrk): Likewise.
* sysdeps/sparc/sparc64/strspn.S (strspn): Likewise.
* sysdeps/sh/memcpy.S (memcpy): Likewise.
* sysdeps/sh/memset.S (memset): Likewise.
* sysdeps/sh/strlen.S (strlen): Likewise.
* sysdeps/s390/s390-32/memchr.S (memchr): Likewise.
* sysdeps/s390/s390-32/memcpy.S (memcpy): Likewise.
* sysdeps/s390/s390-32/memset.S (memset): Likewise.
* sysdeps/s390/s390-32/strcmp.S (strcmp): Likewise.
* sysdeps/s390/s390-32/strcpy.S (strcpy): Likewise.
* sysdeps/s390/s390-32/strncpy.S (strncpy): Likewise.
* sysdeps/s390/s390-64/memchr.S (memchr): Likewise.
* sysdeps/s390/s390-64/memcpy.S (memcpy): Likewise.
* sysdeps/s390/s390-64/memset.S (memset): Likewise.
* sysdeps/s390/s390-64/strcmp.S (strcmp): Likewise.
* sysdeps/s390/s390-64/strcpy.S (strcpy): Likewise.
* sysdeps/s390/s390-64/strncpy.S (strncpy): Likewise.
* sysdeps/x86_64/memcpy.S (memcpy): Likewise.
* sysdeps/x86_64/memset.S (memset): Likewise.
* sysdeps/x86_64/strcat.S (strcat): Likewise.
* sysdeps/x86_64/strchr.S (strchr): Likewise.
* sysdeps/x86_64/strcmp.S (strcmp): Likewise.
* sysdeps/x86_64/strcpy.S (strcpy): Likewise.
* sysdeps/x86_64/strcspn.S (strcspn): Likewise.
* sysdeps/x86_64/strlen.S (strlen): Likewise.
* sysdeps/x86_64/strspn.S (strspn): Likewise.
* string/string-inlines.c: Move...
* sysdeps/generic/string-inlines.c: ...here.
(__memcpy_g, __strchr_g): Remove.
(__NO_INLINE__): Define before including <string.h>,
undefine after. Include bits/string.h and bits/string2.h.
* sysdeps/i386/i486/string-inlines.c: New file.
* sysdeps/i386/string-inlines.c: New file.
* sysdeps/i386/i486/Versions: Remove.
All GLIBC_2.1.1 symbols moved...
* sysdeps/i386/Versions (libc): ...here.
2003-04-29 Ulrich Drepper <drepper@redhat.com>
2003-04-30 00:49:58 +02:00
|
|
|
libc_hidden_builtin_def (memcpy)
|
2011-04-02 01:38:21 +02:00
|
|
|
# if defined SHARED && !defined USE_MULTIARCH && !defined NOT_IN_libc
|
|
|
|
# undef memcpy
|
|
|
|
# include <shlib-compat.h>
|
|
|
|
versioned_symbol (libc, __memcpy, memcpy, GLIBC_2_14);
|
|
|
|
# endif
|
Update.
2004-05-27 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/fpu/bits/mathinline.h (__expm1_code): Define using
__builtin_expm1l for GCC 3.5+.
(__expl): Define using __builtin_expl for GCC 3.4+.
(exp, expf, expl): Don't define for GCC 3.4+.
(tan, tanf, tanl): Don't define for GCC 3.5+.
(__atan2l): Define using __builtin_atan2l for GCC 3.4+.
(atan2, atan2f, atan2l): Don't define for GCC 3.4+ or !__FAST_MATH__.
(fmod, fmodf, fmodl): Don't define for GCC 3.5+ or !__FAST_MATH__.
(fabsf, fabsl): Only provide if __USE_MISC or __USE_ISOC99.
(sin, sinf, sinl, cos, cosf, cosl, log, logf, logl): Don't define
for GCC 3.4+.
(log10, log10f, log10l, asin, asinf, asinl, acos, acosf, acosl):
Don't define for GCC 3.5+.
(atan, atanf, atanl): Don't define for GCC 3.4+ or !__FAST_MATH__.
(log1p, log1pf, log1pl, logb, logbf, logbl, log2, log2f, log2l): Don't
define for GCC 3.5+.
(drem, dremf, dreml): Don't define for GCC 3.5+ or !__FAST_MATH__.
* sysdeps/sparc/fpu/bits/mathinline.h (sqrt, sqrtf, sqrtl): Don't
define for GCC 3.2+.
2004-05-27 Jakub Jelinek <jakub@redhat.com>
* string/bits/string2.h (__bzero): Define even for GCC 3.0+.
* sysdeps/alpha/stpcpy.S (stpcpy): Add libc_hidden_builtin_def.
* sysdeps/alpha/alphaev67/stpcpy.S (stpcpy): Likewise.
* sysdeps/powerpc/powerpc32/stpcpy.S (stpcpy): Likewise.
* sysdeps/powerpc/powerpc64/stpcpy.S (stpcpy): Likewise.
* sysdeps/sparc/sparc32/stpcpy.S (stpcpy): Likewise.
* sysdeps/sparc/sparc64/stpcpy.S (stpcpy): Likewise.
* sysdeps/i386/stpcpy.S (stpcpy): Likewise.
* sysdeps/i386/i586/stpcpy.S (stpcpy): Likewise.
* sysdeps/generic/stpcpy.c (stpcpy): Likewise.
* sysdeps/x86_64/stpcpy.S (stpcpy): Likewise.
* sysdeps/i386/i586/memcpy.S (memcpy): Remove
libc_hidden_builtin_def if MEMPCPY_P.
* sysdeps/x86_64/memcpy.S (memcpy): Likewise.
* sysdeps/i386/i686/mempcpy.S (mempcpy): Add libc_hidden_builtin_def.
* sysdeps/i386/i586/mempcpy.S (mempcpy): Likewise.
* sysdeps/generic/mempcpy.c (mempcpy): Likewise.
* sysdeps/x86_64/mempcpy.S (mempcpy): Likewise.
2004-05-28 08:56:51 +02:00
|
|
|
#endif
|