diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2011-09-21 15:21:28 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-03-28 06:11:19 -0700 |
commit | c835e4cad72cfda9c2702047e6ac31a8aba8e61d (patch) | |
tree | 32a42fdc011570ed3d0bec28b3e1d3c4836c2a5c /sysdeps/i386/i686/multiarch/memset-erms.S | |
parent | e41b395523040fcb58c7d378475720c2836d280c (diff) | |
download | glibc-hjl/erms/i386.tar.gz glibc-hjl/erms/i386.tar.xz glibc-hjl/erms/i386.zip |
Add 32-bit Enhanced REP MOVSB/STOSB (ERMS) memcpy/memset hjl/erms/i386
Add and test 32-bit memcpy/memset with Enhanced REP MOVSB/STOSB (ERMS). * sysdeps/i386/i686/multiarch/Makefile (sysdep_routines): Add bcopy-erms, memcpy-erms, memmove-erms, mempcpy-erms, bzero-erms and memset-erms. * sysdeps/i386/i686/multiarch/bcopy-erms.S: New file. * sysdeps/i386/i686/multiarch/bzero-erms.S: Likewise. * sysdeps/i386/i686/multiarch/memcpy-erms.S: Likewise. * sysdeps/i386/i686/multiarch/memmove-erms.S: Likewise. * sysdeps/i386/i686/multiarch/mempcpy-erms.S: Likewise. * sysdeps/i386/i686/multiarch/memset-erms.S: Likewise. * sysdeps/i386/i686/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add __bcopy_erms, __bzero_erms, __memmove_chk_erms, __memmove_erms, __memset_chk_erms, __memset_erms, __memcpy_chk_erms, __memcpy_erms, __mempcpy_chk_erms and __mempcpy_erms.
Diffstat (limited to 'sysdeps/i386/i686/multiarch/memset-erms.S')
-rw-r--r-- | sysdeps/i386/i686/multiarch/memset-erms.S | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/sysdeps/i386/i686/multiarch/memset-erms.S b/sysdeps/i386/i686/multiarch/memset-erms.S new file mode 100644 index 0000000000..807a6e4f7c --- /dev/null +++ b/sysdeps/i386/i686/multiarch/memset-erms.S @@ -0,0 +1,69 @@ +/* memset with Enhanced REP MOVSB/STOSB + Copyright (C) 2014 Free Software Foundation, Inc. + 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 + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef NOT_IN_libc + +#include <sysdep.h> + +#define CFI_PUSH(REG) \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (REG, 0) + +#define CFI_POP(REG) \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (REG) + +#define PUSH(REG) pushl REG; CFI_PUSH (REG) +#define POP(REG) popl REG; CFI_POP (REG) + +#define STR1 8 +#ifdef USE_AS_BZERO +#define N STR1+4 +#else +#define STR2 STR1+4 +#define N STR2+4 +#endif + + .section .text.erms,"ax",@progbits +#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BZERO +ENTRY (__memset_chk_erms) + movl 12(%esp), %eax + cmpl %eax, 16(%esp) + jb HIDDEN_JUMPTARGET (__chk_fail) +END (__memset_chk_erms) +#endif +ENTRY (__memset_erms) + PUSH (%edi) + movl N(%esp), %ecx + movl STR1(%esp), %edi +#ifdef USE_AS_BZERO + xor %eax, %eax +#else + movzbl STR2(%esp), %eax + mov %edi, %edx +#endif + rep stosb +#ifndef USE_AS_BZERO + mov %edx, %eax +#endif + POP (%edi) + ret +END (__memset_erms) + +#endif |