]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/i386/stpncpy.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / i386 / stpncpy.S
index acde5e3d6647bb906142084fbe7a5311b9c8e80c..7613e8fd9920b9813edc1e43f52bfbd938e74cfe 100644 (file)
@@ -1,7 +1,7 @@
-/* copy no more then N bytes from SRC to DEST, returning the address of
+/* copy no more than N bytes from SRC to DEST, returning the address of
    the terminating '\0' in DEST.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994,1995,1996,1997,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
    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.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
 #include "asm-syntax.h"
-#include "bp-sym.h"
-#include "bp-asm.h"
 
-#define PARMS  LINKAGE+4       /* space for 1 saved reg */
+#define PARMS  4+4     /* space for 1 saved reg */
 #define RTN    PARMS
-#define DEST   RTN+RTN_SIZE
-#define SRC    DEST+PTR_SIZE
-#define LEN    SRC+PTR_SIZE
+#define DEST   RTN
+#define SRC    DEST+4
+#define LEN    SRC+4
 
        .text
-ENTRY (BP_SYM (__stpncpy))
-       ENTER
+ENTRY (__stpncpy)
 
        pushl %esi
+       cfi_adjust_cfa_offset (4)
 
        movl DEST(%esp), %eax
        movl SRC(%esp), %esi
+       cfi_rel_offset (esi, 0)
        movl LEN(%esp), %ecx
-       CHECK_BOUNDS_LOW (%eax, DEST(%esp))
-       CHECK_BOUNDS_LOW (%esi, SRC(%esp))
 
        subl %eax, %esi         /* magic: reduce number of loop variants
                                   to one using addressing mode */
@@ -54,7 +50,7 @@ ENTRY (BP_SYM (__stpncpy))
        ALIGN(4)
 
        /* Four times unfolded loop with two loop counters.  We get the
-          the third value (the source address) by using the index+base
+          third value (the source address) by using the index+base
           addressing mode.  */
 L(2):  movb (%eax,%esi), %dl   /* load current char */
        movb %dl, (%eax)        /* and store it */
@@ -140,18 +136,12 @@ L(8):
 L(3):  decl %ecx               /* all bytes written? */
        jnz L(8)                /* no, then again */
 
-L(9):
-#if __BOUNDED_POINTERS__
-       addl %eax, %esi         /* undo magic: %esi now points beyond end of SRC */
-       CHECK_BOUNDS_HIGH (%esi, SRC(%esp), jbe)
-       CHECK_BOUNDS_HIGH (%eax, DEST(%esp), jbe)
-       RETURN_BOUNDED_POINTER (DEST(%esp))
-#endif
-       popl %esi               /* restore saved register content */
-
-       LEAVE
-       RET_PTR
-END (BP_SYM (__stpncpy))
-
-libc_hidden_def (BP_SYM (__stpncpy))
-weak_alias (BP_SYM (__stpncpy), BP_SYM (stpncpy))
+L(9):  popl %esi               /* restore saved register content */
+       cfi_adjust_cfa_offset (-4)
+       cfi_restore (esi)
+
+       ret
+END (__stpncpy)
+
+libc_hidden_def (__stpncpy)
+weak_alias (__stpncpy, stpncpy)