]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / x86_64 / multiarch / strcpy-sse2-unaligned.S
index 4dd236329f9cf0180a16e583ae1407dd4e69ef56..456226d064e351f5f730e2f4528d3fd68114c4bb 100644 (file)
@@ -1,5 +1,5 @@
 /* strcpy with SSE2 and unaligned load
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
    Contributed by Intel Corporation.
    This file is part of the GNU C Library.
 
@@ -15,9 +15,9 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
-#ifndef NOT_IN_libc
+#if IS_IN (libc)
 
 # ifndef USE_AS_STRCAT
 #  include <sysdep.h>
        lea     TABLE(%rip), %r11;                              \
        movslq  (%r11, INDEX, SCALE), %rcx;                     \
        lea     (%r11, %rcx), %rcx;                             \
-       jmp     *%rcx
+       _CET_NOTRACK jmp *%rcx
 
 # ifndef USE_AS_STRCAT
 
 .text
 ENTRY (STRCPY)
 #  ifdef USE_AS_STRNCPY
-       mov     %rdx, %r8
-       test    %r8, %r8
+       mov     %RDX_LP, %R8_LP
+       test    %R8_LP, %R8_LP
        jz      L(ExitZero)
 #  endif
        mov     %rsi, %rcx
@@ -93,12 +93,14 @@ ENTRY (STRCPY)
        movdqu  (%rsi, %rcx), %xmm1   /* copy 16 bytes */
        movdqu  %xmm1, (%rdi)
 
-/* If source adress alignment != destination adress alignment */
+/* If source address alignment != destination address alignment */
        .p2align 4
 L(Unalign16Both):
        sub     %rcx, %rdi
 # ifdef USE_AS_STRNCPY
        add     %rcx, %r8
+       sbb     %rcx, %rcx
+       or      %rcx, %r8
 # endif
        mov     $16, %rcx
        movdqa  (%rsi, %rcx), %xmm1
@@ -289,7 +291,7 @@ L(Unaligned64Leave):
        BRANCH_TO_JMPTBL_ENTRY (L(ExitTable), %rdx, 4)
 # endif
 
-/* If source adress alignment == destination adress alignment */
+/* If source address alignment == destination address alignment */
 
 L(SourceStringAlignmentLess32):
        pxor    %xmm0, %xmm0