No need to include namespace.h; no other assembly code does.
This commit is contained in:
parent
c0614acad2
commit
7602642e76
@ -29,21 +29,17 @@
|
|||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
|
|
||||||
RCSID("$NetBSD: strcpy_arm.S,v 1.3 2013/08/11 04:56:32 matt Exp $")
|
RCSID("$NetBSD: strcpy_arm.S,v 1.4 2017/01/13 13:14:54 christos Exp $")
|
||||||
|
|
||||||
#ifdef STRLCPY
|
#ifdef STRLCPY
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
WEAK_ALIAS(strlcpy, _strlcpy)
|
WEAK_ALIAS(strlcpy, _strlcpy)
|
||||||
#endif
|
#endif
|
||||||
#define FUNCNAME strlcpy
|
#define FUNCNAME _strlcpy
|
||||||
#elif defined(STRNCPY)
|
#elif defined(STRNCPY)
|
||||||
#define FUNCNAME strncpy
|
#define FUNCNAME _strncpy
|
||||||
#else
|
#else
|
||||||
#define FUNCNAME strcpy
|
#define FUNCNAME _strcpy
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
#include "namespace.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __ARMEL__
|
#ifdef __ARMEL__
|
||||||
|
@ -28,13 +28,12 @@
|
|||||||
*/
|
*/
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
|
|
||||||
RCSID("$NetBSD: strcpy_naive.S,v 1.4 2013/08/20 21:37:39 matt Exp $")
|
RCSID("$NetBSD: strcpy_naive.S,v 1.5 2017/01/13 13:14:54 christos Exp $")
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
#ifdef STRLCPY
|
#ifdef STRLCPY
|
||||||
WEAK_ALIAS(strlcpy, _strlcpy)
|
WEAK_ALIAS(strlcpy, _strlcpy)
|
||||||
#endif
|
#endif
|
||||||
#include "namespace.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,7 +43,7 @@ WEAK_ALIAS(strlcpy, _strlcpy)
|
|||||||
|
|
||||||
#if defined(STRLCPY)
|
#if defined(STRLCPY)
|
||||||
/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */
|
/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */
|
||||||
ENTRY(strlcpy)
|
ENTRY(_strlcpy)
|
||||||
add ip, r1, #1 /* save src pointer (+ NUL) */
|
add ip, r1, #1 /* save src pointer (+ NUL) */
|
||||||
subs r2, r2, #1 /* make sure there's room for a NUL */
|
subs r2, r2, #1 /* make sure there's room for a NUL */
|
||||||
blt 3f /* no room, do the strlen */
|
blt 3f /* no room, do the strlen */
|
||||||
@ -63,10 +62,10 @@ ENTRY(strlcpy)
|
|||||||
bne 3b /* no, get next byte */
|
bne 3b /* no, get next byte */
|
||||||
4: sub r0, r1, ip /* return length of src string */
|
4: sub r0, r1, ip /* return length of src string */
|
||||||
RET
|
RET
|
||||||
END(strlcpy)
|
END(_strlcpy)
|
||||||
#elif defined(STRNCPY)
|
#elif defined(STRNCPY)
|
||||||
/* LINTSTUB: char * strncpy(char *, const char *, size_t) */
|
/* LINTSTUB: char * strncpy(char *, const char *, size_t) */
|
||||||
ENTRY(strncpy)
|
ENTRY(_strncpy)
|
||||||
mov ip, r0 /* we want to preserve r0 */
|
mov ip, r0 /* we want to preserve r0 */
|
||||||
add r2, r2, r0 /* get end of dst buffer */
|
add r2, r2, r0 /* get end of dst buffer */
|
||||||
1: cmp ip, r2 /* are at the end of dst already? */
|
1: cmp ip, r2 /* are at the end of dst already? */
|
||||||
@ -79,15 +78,15 @@ ENTRY(strncpy)
|
|||||||
strblt r3, [ip], #1 /* no, write a NUL */
|
strblt r3, [ip], #1 /* no, write a NUL */
|
||||||
blt 2b /* until dst is filled */
|
blt 2b /* until dst is filled */
|
||||||
3: RET /* return dst pointer */
|
3: RET /* return dst pointer */
|
||||||
END(strncpy)
|
END(_strncpy)
|
||||||
#else
|
#else
|
||||||
/* LINTSTUB: char * strcpy(char *, const char *) */
|
/* LINTSTUB: char * strcpy(char *, const char *) */
|
||||||
ENTRY(strcpy)
|
ENTRY(_strcpy)
|
||||||
mov ip, r0 /* we want to preserve r0 */
|
mov ip, r0 /* we want to preserve r0 */
|
||||||
1: ldrb r3, [r1], #1 /* read a byte */
|
1: ldrb r3, [r1], #1 /* read a byte */
|
||||||
strb r3, [ip], #1 /* write a byte */
|
strb r3, [ip], #1 /* write a byte */
|
||||||
teq r3, #0 /* was it a NUL? */
|
teq r3, #0 /* was it a NUL? */
|
||||||
bne 1b /* no, try next byte */
|
bne 1b /* no, try next byte */
|
||||||
RET /* return dst pointer */
|
RET /* return dst pointer */
|
||||||
END(strcpy)
|
END(_strcpy)
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,13 +28,12 @@
|
|||||||
*/
|
*/
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
|
|
||||||
RCSID("$NetBSD: strcpy_thumb.S,v 1.1 2013/08/20 21:32:50 matt Exp $")
|
RCSID("$NetBSD: strcpy_thumb.S,v 1.2 2017/01/13 13:14:54 christos Exp $")
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
#ifdef STRLCPY
|
#ifdef STRLCPY
|
||||||
WEAK_ALIAS(strlcpy, _strlcpy)
|
WEAK_ALIAS(strlcpy, _strlcpy)
|
||||||
#endif
|
#endif
|
||||||
#include "namespace.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,7 +43,7 @@ WEAK_ALIAS(strlcpy, _strlcpy)
|
|||||||
|
|
||||||
#if defined(STRLCPY)
|
#if defined(STRLCPY)
|
||||||
/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */
|
/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */
|
||||||
ENTRY(strlcpy)
|
ENTRY(_strlcpy)
|
||||||
adds r3, r1, #1 /* save src pointer (+ NUL) */
|
adds r3, r1, #1 /* save src pointer (+ NUL) */
|
||||||
subs r2, r2, #1 /* make sure there's room for a NUL */
|
subs r2, r2, #1 /* make sure there's room for a NUL */
|
||||||
blt 3f /* no room, do the strlen */
|
blt 3f /* no room, do the strlen */
|
||||||
@ -66,10 +65,10 @@ ENTRY(strlcpy)
|
|||||||
bne 3b /* no, get next byte */
|
bne 3b /* no, get next byte */
|
||||||
4: subs r0, r1, r3 /* return length of src string */
|
4: subs r0, r1, r3 /* return length of src string */
|
||||||
RET
|
RET
|
||||||
END(strlcpy)
|
END(_strlcpy)
|
||||||
#elif defined(STRNCPY)
|
#elif defined(STRNCPY)
|
||||||
/* LINTSTUB: char * strncpy(char *, const char *, size_t) */
|
/* LINTSTUB: char * strncpy(char *, const char *, size_t) */
|
||||||
ENTRY(strncpy)
|
ENTRY(_strncpy)
|
||||||
mov ip, r0 /* we want to preserve r0 */
|
mov ip, r0 /* we want to preserve r0 */
|
||||||
adds r2, r2, r0 /* get end of dst buffer */
|
adds r2, r2, r0 /* get end of dst buffer */
|
||||||
subs r1, r1, r0 /* allows to only increment once */
|
subs r1, r1, r0 /* allows to only increment once */
|
||||||
@ -87,10 +86,10 @@ ENTRY(strncpy)
|
|||||||
b 2b /* until dst is filled */
|
b 2b /* until dst is filled */
|
||||||
3: mov r0, ip /* return dst pointer */
|
3: mov r0, ip /* return dst pointer */
|
||||||
RET
|
RET
|
||||||
END(strncpy)
|
END(_strncpy)
|
||||||
#else
|
#else
|
||||||
/* LINTSTUB: char * strcpy(char *, const char *) */
|
/* LINTSTUB: char * strcpy(char *, const char *) */
|
||||||
ENTRY(strcpy)
|
ENTRY(_strcpy)
|
||||||
subs r2, r0, r1 /* we want to preserve r0 */
|
subs r2, r0, r1 /* we want to preserve r0 */
|
||||||
1: ldrb r3, [r1] /* read a byte */
|
1: ldrb r3, [r1] /* read a byte */
|
||||||
strb r3, [r2, r1] /* write a byte */
|
strb r3, [r2, r1] /* write a byte */
|
||||||
@ -98,5 +97,5 @@ ENTRY(strcpy)
|
|||||||
cmp r3, #0 /* was it a NUL? */
|
cmp r3, #0 /* was it a NUL? */
|
||||||
bne 1b /* no, try next byte */
|
bne 1b /* no, try next byte */
|
||||||
RET /* return dst pointer */
|
RET /* return dst pointer */
|
||||||
END(strcpy)
|
END(_strcpy)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
/* $NetBSD: strlcat.S,v 1.2 2013/08/20 21:08:54 matt Exp $ */
|
/* $NetBSD: strlcat.S,v 1.3 2017/01/13 13:14:54 christos Exp $ */
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
WEAK_ALIAS(strlcat, _strlcat)
|
WEAK_ALIAS(strlcat, _strlcat)
|
||||||
#include "namespace.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_STANDALONE) && 0 /* arm version is always smaller */
|
#if defined(_STANDALONE) && 0 /* arm version is always smaller */
|
||||||
|
Loading…
Reference in New Issue
Block a user