Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
- Fix for default mtree style
- Update libelf
- Importing libexecinfo
- Resynchronize GCC, mpc, gmp, mpfr
- build.sh: Replace params with show-params.
This has been done as the make target has been renamed in the same
way, while a new target named params has been added. This new
target generates a file containing all the parameters, instead of
printing it on the console.
- Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
get getservbyport() out of the inner loop
Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bcmp.S,v 1.2 2008/04/28 20:22:52 martin Exp $ */
|
||||
/* $NetBSD: bcmp.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -68,21 +68,34 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: bcmp.S,v 1.2 2008/04/28 20:22:52 martin Exp $")
|
||||
RCSID("$NetBSD: bcmp.S,v 1.6 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef __mcoldfire__
|
||||
#define CMPMB(a,b) movb b,%d2; cmpb a,%d2
|
||||
#define CMPMW(a,b) movw b,%d2; cmpw a,%d2
|
||||
#define CMPML(a,b) movl b,%d2; cmpl a,%d2
|
||||
#else
|
||||
#define CMPMB(a,b) cmpmb a,b
|
||||
#define CMPMW(a,b) cmpmw a,b
|
||||
#define CMPML(a,b) cmpml a,b
|
||||
#endif
|
||||
|
||||
ENTRY(bcmp)
|
||||
movl %sp@(4),%a0 | string 1
|
||||
movl %sp@(8),%a1 | string 2
|
||||
movl %sp@(12),%d1 | length
|
||||
movl 4(%sp),%a0 | string 1
|
||||
movl 8(%sp),%a1 | string 2
|
||||
movl 12(%sp),%d1 | length
|
||||
#ifdef __mcoldfire__
|
||||
movl %d2,-(%sp) | save temp
|
||||
#endif
|
||||
|
||||
/*
|
||||
* It isn't worth the overhead of aligning to {long}word boundries
|
||||
* if the string is too short.
|
||||
*/
|
||||
cmpl #8,%d1
|
||||
jlt Lbcbyte
|
||||
jlt .Lbcbyte
|
||||
|
||||
#ifdef __mc68010__
|
||||
/*
|
||||
@@ -93,75 +106,91 @@ ENTRY(bcmp)
|
||||
movl %a0,%d0
|
||||
addl %a1,%d0
|
||||
btst #0,%d0
|
||||
jne Lbcbyte
|
||||
jne .Lbcbyte
|
||||
#endif /* __mc68010__ */
|
||||
|
||||
/* word align */
|
||||
movl %a0,%d0
|
||||
btst #0,%d0
|
||||
jeq Lbcalgndw
|
||||
cmpmb %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
jeq .Lbcalgndw
|
||||
CMPMB((%a0)+,(%a1)+)
|
||||
jne .Lbcnoteq
|
||||
subql #1,%d1
|
||||
Lbcalgndw:
|
||||
.Lbcalgndw:
|
||||
/* long word align */
|
||||
btst #1,%d0
|
||||
jeq Lbcalgndl
|
||||
cmpmw %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
jeq .Lbcalgndl
|
||||
CMPMW((%a0)+,(%a1)+)
|
||||
jne .Lbcnoteq
|
||||
subql #2,%d1
|
||||
Lbcalgndl:
|
||||
.Lbcalgndl:
|
||||
/* compare by 8 longwords */
|
||||
movl %d1,%d0
|
||||
lsrl #5,%d0 | cnt = len / 32
|
||||
jeq Lbclong | if (cnt)
|
||||
jeq .Lbclong | if (cnt)
|
||||
andl #31,%d1 | len %= 32
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbc32loop:
|
||||
cmpml %a0@+,%a1@+ | compare 8 longwords
|
||||
jne Lbcnoteq | not equal, return non-zero
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
cmpml %a0@+,%a1@+
|
||||
jne Lbcnoteq
|
||||
dbf %d0,Lbc32loop | till done
|
||||
.Lbc32loop:
|
||||
CMPML((%a0)+,(%a1)+) | compare 1 of 8 longwords
|
||||
jne .Lbcnoteq | not equal, return non-zero
|
||||
CMPML((%a0)+,(%a1)+) | compare 2 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
CMPML((%a0)+,(%a1)+) | compare 3 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
CMPML((%a0)+,(%a1)+) | compare 4 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
CMPML((%a0)+,(%a1)+) | compare 5 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
CMPML((%a0)+,(%a1)+) | compare 6 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
CMPML((%a0)+,(%a1)+) | compare 7 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
CMPML((%a0)+,(%a1)+) | compare 8 of 8 longwords
|
||||
jne .Lbcnoteq
|
||||
#ifndef __mcoldfire__
|
||||
dbf %d0,.Lbc32loop | till done
|
||||
clrw %d0
|
||||
#endif
|
||||
subql #1,%d0
|
||||
jcc Lbc32loop
|
||||
jcc .Lbc32loop
|
||||
|
||||
Lbclong:
|
||||
.Lbclong:
|
||||
/* compare by longwords */
|
||||
movl %d1,%d0
|
||||
lsrl #2,%d0 | cnt = len / 4
|
||||
jeq Lbcbyte | if (cnt)
|
||||
jeq .Lbcbyte | if (cnt)
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbclloop:
|
||||
cmpml %a0@+,%a1@+ | compare a longword
|
||||
jne Lbcnoteq | not equal, return non-zero
|
||||
dbf %d0,Lbclloop | till done
|
||||
.Lbclloop:
|
||||
CMPML((%a0)+,(%a1)+) | compare a longword
|
||||
jne .Lbcnoteq | not equal, return non-zero
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbclloop | till done
|
||||
#else
|
||||
dbf %d0,.Lbclloop | till done
|
||||
#endif
|
||||
andl #3,%d1 | len %= 4
|
||||
jeq Lbcdone
|
||||
jeq .Lbcdone
|
||||
|
||||
subql #1,%d1 | set up for dbf
|
||||
Lbcbloop:
|
||||
cmpmb %a0@+,%a1@+ | compare a byte
|
||||
jne Lbcnoteq | not equal, return non-zero
|
||||
Lbcbyte:
|
||||
dbf %d1,Lbcbloop
|
||||
Lbcdone:
|
||||
.Lbcbloop:
|
||||
CMPMB((%a0)+,(%a1)+) | compare a byte
|
||||
jne .Lbcnoteq | not equal, return non-zero
|
||||
.Lbcbyte:
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbcbloop | till done
|
||||
#else
|
||||
dbf %d1,.Lbcbloop
|
||||
#endif
|
||||
.Lbcdone:
|
||||
#ifdef __mcoldfire__
|
||||
movl (%sp)+,%d2 | restore temp
|
||||
#endif
|
||||
movql #0,%d0
|
||||
rts
|
||||
|
||||
Lbcnoteq:
|
||||
.Lbcnoteq:
|
||||
movql #1,%d0
|
||||
rts
|
||||
END(bcmp)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bcopy.S,v 1.2 2008/04/28 20:22:52 martin Exp $ */
|
||||
/* $NetBSD: bcopy.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -68,38 +68,38 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)bcopy.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: bcopy.S,v 1.2 2008/04/28 20:22:52 martin Exp $")
|
||||
RCSID("$NetBSD: bcopy.S,v 1.6 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
||||
#ifdef MEMCOPY
|
||||
ENTRY(memcpy)
|
||||
#define XCOPY memcpy
|
||||
#elif defined(MEMMOVE)
|
||||
#define XCOPY memmove
|
||||
#else
|
||||
#ifdef MEMMOVE
|
||||
ENTRY(memmove)
|
||||
#else
|
||||
ENTRY(bcopy)
|
||||
#endif
|
||||
#define XCOPY bcopy
|
||||
#endif
|
||||
|
||||
ENTRY(XCOPY)
|
||||
#if defined(MEMCOPY) || defined(MEMMOVE)
|
||||
movl %sp@(4),%a1 | dest address
|
||||
movl %sp@(8),%a0 | src address
|
||||
movl 4(%sp),%a1 | dest address
|
||||
movl 8(%sp),%a0 | src address
|
||||
#else
|
||||
movl %sp@(4),%a0 | src address
|
||||
movl %sp@(8),%a1 | dest address
|
||||
movl 4(%sp),%a0 | src address
|
||||
movl 8(%sp),%a1 | dest address
|
||||
#endif
|
||||
movl %sp@(12),%d1 | count
|
||||
movl 12(%sp),%d1 | count
|
||||
|
||||
cmpl %a1,%a0 | src after dest?
|
||||
jlt Lbcback | yes, must copy backwards
|
||||
jlt .Lbcback | yes, must copy backwards
|
||||
|
||||
/*
|
||||
* It isn't worth the overhead of aligning to {long}word boundries
|
||||
* if the string is too short.
|
||||
*/
|
||||
cmpl #8,%d1
|
||||
jlt Lbcfbyte
|
||||
jlt .Lbcfbyte
|
||||
|
||||
#ifdef __mc68010__
|
||||
/*
|
||||
@@ -110,62 +110,74 @@ ENTRY(bcopy)
|
||||
movl %a0,%d0
|
||||
addl %a1,%d0
|
||||
btst #0,%d0
|
||||
jne Lbcfbyte
|
||||
jne .Lbcfbyte
|
||||
#endif /* __mc68010__ */
|
||||
|
||||
/* word align */
|
||||
movl %a1,%d0
|
||||
btst #0,%d0 | if (dst & 1)
|
||||
jeq Lbcfalgndw |
|
||||
movb %a0@+,%a1@+ | *(char *)dst++ = *(char *) src++
|
||||
jeq .Lbcfalgndw |
|
||||
movb (%a0)+,(%a1)+ | *(char *)dst++ = *(char *) src++
|
||||
subql #1,%d1 | len--
|
||||
Lbcfalgndw:
|
||||
.Lbcfalgndw:
|
||||
/* long word align */
|
||||
btst #1,%d0 | if (dst & 2)
|
||||
jeq Lbcfalgndl
|
||||
movw %a0@+,%a1@+ | *(short *)dst++ = *(short *) dst++
|
||||
jeq .Lbcfalgndl
|
||||
movw (%a0)+,(%a1)+ | *(short *)dst++ = *(short *) dst++
|
||||
subql #2,%d1 | len -= 2
|
||||
Lbcfalgndl:
|
||||
.Lbcfalgndl:
|
||||
/* copy by 8 longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #5,%d0 | cnt = len / 32
|
||||
jeq Lbcflong | if (cnt)
|
||||
jeq .Lbcflong | if (cnt)
|
||||
andl #31,%d1 | len %= 32
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbcf32loop:
|
||||
movl %a0@+,%a1@+ | copy 8 long words
|
||||
movl %a0@+,%a1@+
|
||||
movl %a0@+,%a1@+
|
||||
movl %a0@+,%a1@+
|
||||
movl %a0@+,%a1@+
|
||||
movl %a0@+,%a1@+
|
||||
movl %a0@+,%a1@+
|
||||
movl %a0@+,%a1@+
|
||||
dbf %d0,Lbcf32loop | till done
|
||||
.Lbcf32loop:
|
||||
movl (%a0)+,(%a1)+ | copy 8 long words
|
||||
movl (%a0)+,(%a1)+
|
||||
movl (%a0)+,(%a1)+
|
||||
movl (%a0)+,(%a1)+
|
||||
movl (%a0)+,(%a1)+
|
||||
movl (%a0)+,(%a1)+
|
||||
movl (%a0)+,(%a1)+
|
||||
movl (%a0)+,(%a1)+
|
||||
#ifndef __mcoldfire__
|
||||
dbf %d0,.Lbcf32loop | till done
|
||||
clrw %d0
|
||||
#endif
|
||||
subql #1,%d0
|
||||
jcc Lbcf32loop
|
||||
jcc .Lbcf32loop
|
||||
|
||||
Lbcflong:
|
||||
.Lbcflong:
|
||||
/* copy by longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #2,%d0 | cnt = len / 4
|
||||
jeq Lbcfbyte | if (cnt)
|
||||
jeq .Lbcfbyte | if (cnt)
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbcflloop:
|
||||
movl %a0@+,%a1@+ | copy longwords
|
||||
dbf %d0,Lbcflloop | til done
|
||||
.Lbcflloop:
|
||||
movl (%a0)+,(%a1)+ | copy longwords
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbcflloop | til done
|
||||
#else
|
||||
dbf %d0,.Lbcflloop | til done
|
||||
#endif
|
||||
andl #3,%d1 | len %= 4
|
||||
jeq Lbcdone
|
||||
jeq .Lbcdone
|
||||
|
||||
subql #1,%d1 | set up for dbf
|
||||
Lbcfbloop:
|
||||
movb %a0@+,%a1@+ | copy bytes
|
||||
Lbcfbyte:
|
||||
dbf %d1,Lbcfbloop | till done
|
||||
Lbcdone:
|
||||
.Lbcfbloop:
|
||||
movb (%a0)+,(%a1)+ | copy bytes
|
||||
.Lbcfbyte:
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbcfbloop | til done
|
||||
#else
|
||||
dbf %d1,.Lbcfbloop | till done
|
||||
#endif
|
||||
.Lbcdone:
|
||||
#if defined(MEMCOPY) || defined(MEMMOVE)
|
||||
movl %sp@(4),%d0 | dest address
|
||||
movl 4(%sp),%d0 | dest address
|
||||
#if defined(__SVR4_ABI__)
|
||||
moveal %d0,%a0
|
||||
#endif
|
||||
@@ -173,7 +185,7 @@ Lbcdone:
|
||||
rts
|
||||
|
||||
|
||||
Lbcback:
|
||||
.Lbcback:
|
||||
addl %d1,%a0 | src pointer to end
|
||||
addl %d1,%a1 | dest pointer to end
|
||||
|
||||
@@ -182,7 +194,7 @@ Lbcback:
|
||||
* if the string is too short.
|
||||
*/
|
||||
cmpl #8,%d1
|
||||
jlt Lbcbbyte
|
||||
jlt .Lbcbbyte
|
||||
|
||||
#ifdef __mc68010__
|
||||
/*
|
||||
@@ -193,64 +205,77 @@ Lbcback:
|
||||
movl %a0,%d0
|
||||
addl %a1,%d0
|
||||
btst #0,%d0
|
||||
jne Lbcbbyte
|
||||
jne .Lbcbbyte
|
||||
#endif /* __mc68010__ */
|
||||
|
||||
/* word align */
|
||||
movl %a1,%d0
|
||||
btst #0,%d0 | if (dst & 1)
|
||||
jeq Lbcbalgndw |
|
||||
movb %a0@-,%a1@- | *(char *)dst-- = *(char *) src--
|
||||
jeq .Lbcbalgndw |
|
||||
movb -(%a0),-(%a1) | *(char *)dst-- = *(char *) src--
|
||||
subql #1,%d1 | len--
|
||||
Lbcbalgndw:
|
||||
.Lbcbalgndw:
|
||||
/* long word align */
|
||||
btst #1,%d0 | if (dst & 2)
|
||||
jeq Lbcbalgndl
|
||||
movw %a0@-,%a1@- | *(short *)dst-- = *(short *) dst--
|
||||
jeq .Lbcbalgndl
|
||||
movw -(%a0),-(%a1) | *(short *)dst-- = *(short *) dst--
|
||||
subql #2,%d1 | len -= 2
|
||||
Lbcbalgndl:
|
||||
.Lbcbalgndl:
|
||||
/* copy by 8 longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #5,%d0 | cnt = len / 32
|
||||
jeq Lbcblong | if (cnt)
|
||||
jeq .Lbcblong | if (cnt)
|
||||
andl #31,%d1 | len %= 32
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbcb32loop:
|
||||
movl %a0@-,%a1@- | copy 8 long words
|
||||
movl %a0@-,%a1@-
|
||||
movl %a0@-,%a1@-
|
||||
movl %a0@-,%a1@-
|
||||
movl %a0@-,%a1@-
|
||||
movl %a0@-,%a1@-
|
||||
movl %a0@-,%a1@-
|
||||
movl %a0@-,%a1@-
|
||||
dbf %d0,Lbcb32loop | till done
|
||||
.Lbcb32loop:
|
||||
movl -(%a0),-(%a1) | copy 8 long words
|
||||
movl -(%a0),-(%a1)
|
||||
movl -(%a0),-(%a1)
|
||||
movl -(%a0),-(%a1)
|
||||
movl -(%a0),-(%a1)
|
||||
movl -(%a0),-(%a1)
|
||||
movl -(%a0),-(%a1)
|
||||
movl -(%a0),-(%a1)
|
||||
#ifndef __mcoldfire__
|
||||
dbf %d0,.Lbcb32loop | till done
|
||||
clrw %d0
|
||||
#endif
|
||||
subql #1,%d0
|
||||
jcc Lbcb32loop
|
||||
jcc .Lbcb32loop
|
||||
|
||||
Lbcblong:
|
||||
.Lbcblong:
|
||||
/* copy by longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #2,%d0 | cnt = len / 4
|
||||
jeq Lbcbbyte | if (cnt)
|
||||
jeq .Lbcbbyte | if (cnt)
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbcblloop:
|
||||
movl %a0@-,%a1@- | copy longwords
|
||||
dbf %d0,Lbcblloop | til done
|
||||
.Lbcblloop:
|
||||
movl -(%a0),-(%a1) | copy longwords
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbcblloop | til done
|
||||
#else
|
||||
dbf %d0,.Lbcblloop | til done
|
||||
#endif
|
||||
andl #3,%d1 | len %= 4
|
||||
jeq Lbcdone
|
||||
jeq .Lbcdone
|
||||
|
||||
subql #1,%d1 | set up for dbf
|
||||
Lbcbbloop:
|
||||
movb %a0@-,%a1@- | copy bytes
|
||||
Lbcbbyte:
|
||||
dbf %d1,Lbcbbloop | till done
|
||||
.Lbcbbloop:
|
||||
movb -(%a0),-(%a1) | copy bytes
|
||||
.Lbcbbyte:
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbcbbloop | til done
|
||||
#else
|
||||
dbf %d1,.Lbcbbloop | till done
|
||||
#endif
|
||||
|
||||
#if defined(MEMCOPY) || defined(MEMMOVE)
|
||||
movl %sp@(4),%d0 | dest address
|
||||
movl 4(%sp),%d0 | dest address
|
||||
#if defined(__SVR4_ABI__)
|
||||
moveal %d0,%a0
|
||||
#endif
|
||||
#endif
|
||||
rts
|
||||
END(XCOPY)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bzero.S,v 1.2 2008/04/28 20:22:52 martin Exp $ */
|
||||
/* $NetBSD: bzero.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -68,74 +68,87 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)bzero.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: bzero.S,v 1.2 2008/04/28 20:22:52 martin Exp $")
|
||||
RCSID("$NetBSD: bzero.S,v 1.6 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(bzero)
|
||||
movl %d2,%sp@-
|
||||
movl %sp@(8),%a0 | destination
|
||||
movl %sp@(12),%d1 | count
|
||||
movl %d2,-(%sp)
|
||||
movl 8(%sp),%a0 | destination
|
||||
movl 12(%sp),%d1 | count
|
||||
|
||||
movql #0,%d2
|
||||
clrl %d2
|
||||
|
||||
/*
|
||||
* It isn't worth the overhead of aligning to {long}word boundries
|
||||
* if the string is too short.
|
||||
*/
|
||||
cmpl #8,%d1
|
||||
jlt Lbzbyte
|
||||
jlt .Lbzbyte
|
||||
|
||||
/* word align */
|
||||
movl %a0,%d0
|
||||
btst #0,%d0 | if (dst & 1)
|
||||
jeq Lbzalgndw |
|
||||
movb %d2,%a0@+ | *(char *)dst++ = 0
|
||||
jeq .Lbzalgndw |
|
||||
movb %d2,(%a0)+ | *(char *)dst++ = 0
|
||||
subql #1,%d1 | len--
|
||||
Lbzalgndw:
|
||||
.Lbzalgndw:
|
||||
/* long word align */
|
||||
btst #1,%d0 | if (dst & 2)
|
||||
jeq Lbzalgndl |
|
||||
movw %d2,%a0@+ | *(short *)dst++ = 0
|
||||
jeq .Lbzalgndl |
|
||||
movw %d2,(%a0)+ | *(short *)dst++ = 0
|
||||
subql #2,%d1 | len -= 2
|
||||
Lbzalgndl:
|
||||
.Lbzalgndl:
|
||||
/* zero by 8 longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #5,%d0 | cnt = len / 32
|
||||
jeq Lbzlong | if (cnt)
|
||||
jeq .Lbzlong | if (cnt)
|
||||
andl #31,%d1 | len %= 32
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbz32loop:
|
||||
movl %d2,%a0@+ | zero 8 long words
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
dbf %d0,Lbz32loop | till done
|
||||
.Lbz32loop:
|
||||
movl %d2,(%a0)+ | zero 8 long words
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
#ifndef __mcoldfire__
|
||||
dbf %d0,.Lbz32loop | till done
|
||||
clrw %d0
|
||||
#endif
|
||||
subql #1,%d0
|
||||
jcc Lbz32loop
|
||||
jcc .Lbz32loop
|
||||
|
||||
Lbzlong:
|
||||
.Lbzlong:
|
||||
/* copy by longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #2,%d0 | cnt = len / 4
|
||||
jeq Lbzbyte | if (cnt)
|
||||
jeq .Lbzbyte | if (cnt)
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbzlloop:
|
||||
movl %d2,%a0@+ | clear longwords
|
||||
dbf %d0,Lbzlloop | till done
|
||||
.Lbzlloop:
|
||||
movl %d2,(%a0)+ | clear longwords
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbzlloop | till done
|
||||
#else
|
||||
dbf %d0,.Lbzlloop | till done
|
||||
#endif
|
||||
andl #3,%d1 | len %= 4
|
||||
jeq Lbzdone
|
||||
jeq .Lbzdone
|
||||
|
||||
subql #1,%d1 | set up for dbf
|
||||
Lbzbloop:
|
||||
movb %d2,%a0@+ | zero bytes
|
||||
Lbzbyte:
|
||||
dbf %d1,Lbzbloop | till done
|
||||
Lbzdone:
|
||||
movl %sp@+,%d2
|
||||
.Lbzbloop:
|
||||
movb %d2,(%a0)+ | zero bytes
|
||||
.Lbzbyte:
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d0 | decrement
|
||||
jcc .Lbzbloop | till done
|
||||
#else
|
||||
dbf %d1,.Lbzbloop | till done
|
||||
#endif
|
||||
.Lbzdone:
|
||||
movl (%sp)+,%d2
|
||||
rts
|
||||
END(bzero)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs.S,v 1.2 2011/07/09 14:57:29 mrg Exp $ */
|
||||
/* $NetBSD: ffs.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)ffs.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: ffs.S,v 1.2 2011/07/09 14:57:29 mrg Exp $")
|
||||
RCSID("$NetBSD: ffs.S,v 1.6 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -47,30 +47,49 @@
|
||||
|
||||
WEAK_ALIAS(__ffssi2,ffs)
|
||||
|
||||
#ifndef __mc68010__
|
||||
#if (!defined(__mc68010__) && !defined(__mcoldfire__)) || defined(__mcfisac__)
|
||||
|
||||
ENTRY(ffs)
|
||||
movl %sp@(4),%d0
|
||||
movl 4(%sp),%d0
|
||||
movl %d0,%d1
|
||||
negl %d0
|
||||
andl %d0,%d1
|
||||
movql #32,%d0
|
||||
#if defined(__mcfisac__)
|
||||
ff1.l %d1 | count leading zeros
|
||||
#else
|
||||
bfffo %d1{#0:#32},%d1
|
||||
#endif
|
||||
subl %d1,%d0
|
||||
rts
|
||||
END(ffs)
|
||||
|
||||
#elif defined(__mcoldfire__)
|
||||
|
||||
ENTRY(ffs)
|
||||
clrl %d0
|
||||
movl 4(%sp),%d1
|
||||
jeq .L2 | return 0 if 0
|
||||
.L1:
|
||||
addql #1,%d0
|
||||
lsrl #1,%d1 | shift low bit into carry
|
||||
jcc .L1 | keep looping while carry is clear.
|
||||
.L2:
|
||||
rts
|
||||
|
||||
#else /* __mc68010__ */
|
||||
|
||||
ENTRY(ffs)
|
||||
movl %sp@(4),%d0
|
||||
jeq L2
|
||||
movl 4(%sp),%d0
|
||||
jeq .L2
|
||||
movql #31,%d1
|
||||
L1:
|
||||
.L1:
|
||||
lsrl #1,%d0
|
||||
dbcs %d1,L1
|
||||
dbcs %d1,.L1
|
||||
movql #32,%d0
|
||||
subl %d1,%d0
|
||||
L2:
|
||||
.L2:
|
||||
rts
|
||||
END(ffs)
|
||||
|
||||
#endif /* __mc68010__ */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: memcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
|
||||
/* $NetBSD: memcmp.S,v 1.5 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,12 +39,22 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: memcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
|
||||
RCSID("$NetBSD: memcmp.S,v 1.5 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* memcmp(s1, s2, n) */
|
||||
|
||||
#ifdef __mcoldfire__
|
||||
#define CMPMB(a,b) movb b,%d2; cmpb a,%d2
|
||||
#define CMPMW(a,b) movw b,%d2; cmpw a,%d2
|
||||
#define CMPML(a,b) movl b,%d2; cmpl a,%d2
|
||||
#else
|
||||
#define CMPMB(a,b) cmpmb a,b
|
||||
#define CMPMW(a,b) cmpmw a,b
|
||||
#define CMPML(a,b) cmpml a,b
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is probably not the best we can do, but it is still 2-10 times
|
||||
* faster than the C version in the portable gen directory.
|
||||
@@ -54,47 +64,54 @@
|
||||
* - use nested DBcc instructions or use one and limit size to 64K
|
||||
*/
|
||||
ENTRY(memcmp)
|
||||
movl %sp@(4),%a0 | string 1
|
||||
movl %sp@(8),%a1 | string 2
|
||||
movl %sp@(12),%d0 | length
|
||||
jeq bcdone | if zero, nothing to do
|
||||
movl 4(%sp),%a0 | string 1
|
||||
movl 8(%sp),%a1 | string 2
|
||||
movl 12(%sp),%d0 | length
|
||||
#ifdef __mcoldfire__
|
||||
movl %d2,-(%sp) | save temp
|
||||
#endif
|
||||
jeq .Lbcdone | if zero, nothing to do
|
||||
movl %a0,%d1
|
||||
btst #0,%d1 | string 1 address odd?
|
||||
jeq bceven | no, skip alignment
|
||||
cmpmb %a0@+,%a1@+ | yes, compare a byte
|
||||
jne bcnoteq | not equal, return non-zero
|
||||
jeq .Lbceven | no, skip alignment
|
||||
CMPMB((%a0)+,(%a1)+) | yes, compare a byte
|
||||
jne .Lbcnoteq | not equal, return non-zero
|
||||
subql #1,%d0 | adjust count
|
||||
jeq bcdone | count 0, reutrn zero
|
||||
bceven:
|
||||
jeq .Lbcdone | count 0, reutrn zero
|
||||
.Lbceven:
|
||||
movl %a1,%d1
|
||||
btst #0,%d1 | string 2 address odd?
|
||||
jne bcbloop | yes, no hope for alignment, compare bytes
|
||||
jne .Lbcbloop | yes, no hope for alignment, compare bytes
|
||||
movl %d0,%d1 | no, both even
|
||||
lsrl #2,%d1 | convert count to longword count
|
||||
jeq bcbloop | count 0, skip longword loop
|
||||
bclloop:
|
||||
cmpml %a0@+,%a1@+ | compare a longword
|
||||
jne bcnoteql | not equal, return non-zero
|
||||
jeq .Lbcbloop | count 0, skip longword loop
|
||||
.Lbclloop:
|
||||
CMPML((%a0)+,(%a1)+) | compare a longword
|
||||
jne .Lbcnoteql | not equal, return non-zero
|
||||
subql #1,%d1 | adjust count
|
||||
jne bclloop | still more, keep comparing
|
||||
jne .Lbclloop | still more, keep comparing
|
||||
andl #3,%d0 | what remains
|
||||
jeq bcdone | nothing, all done
|
||||
bcbloop:
|
||||
cmpmb %a0@+,%a1@+ | compare a byte
|
||||
jne bcnoteq | not equal, return non-zero
|
||||
jeq .Lbcdone | nothing, all done
|
||||
.Lbcbloop:
|
||||
CMPMB((%a0)+,(%a1)+) | compare a byte
|
||||
jne .Lbcnoteq | not equal, return non-zero
|
||||
subql #1,%d0 | adjust count
|
||||
jne bcbloop | still more, keep going
|
||||
jne .Lbcbloop | still more, keep going
|
||||
rts
|
||||
bcnoteql:
|
||||
.Lbcnoteql:
|
||||
subql #4,%a0
|
||||
subql #4,%a1
|
||||
movl #4,%d0
|
||||
jra bcbloop
|
||||
bcnoteq:
|
||||
jra .Lbcbloop
|
||||
.Lbcnoteq:
|
||||
clrl %d0
|
||||
clrl %d1
|
||||
movb %a0@-,%d0
|
||||
movb %a1@-,%d1
|
||||
movb -(%a0),%d0
|
||||
movb -(%a1),%d1
|
||||
subl %d1,%d0
|
||||
bcdone:
|
||||
.Lbcdone:
|
||||
#ifdef __mcoldfire__
|
||||
movl (%sp)+,%sp | restore temp
|
||||
#endif
|
||||
rts
|
||||
END(memcmp)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: memset.S,v 1.2 2008/04/28 20:22:52 martin Exp $ */
|
||||
/* $NetBSD: memset.S,v 1.7 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -68,95 +68,107 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)bzero.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: memset.S,v 1.2 2008/04/28 20:22:52 martin Exp $")
|
||||
RCSID("$NetBSD: memset.S,v 1.7 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(memset)
|
||||
movl %d2,%sp@-
|
||||
movl %sp@(8),%a0 | destination
|
||||
movl %sp@(16),%d1 | count
|
||||
movb %sp@(15),%d2 | character
|
||||
movl %d2,-(%sp)
|
||||
movl 8(%sp),%a0 | destination
|
||||
movl 16(%sp),%d1 | count
|
||||
movb 15(%sp),%d2 | get fill character
|
||||
|
||||
/*
|
||||
* It isn't worth the overhead of aligning to {long}word boundries
|
||||
* if the string is too short.
|
||||
*/
|
||||
cmpl #15,%d1
|
||||
jlt Lbzbyte
|
||||
jlt .Lbzbyte
|
||||
|
||||
clrl %d0 | replicate byte to fill longword
|
||||
movb %d2,%d0
|
||||
movl %d0,%d2
|
||||
lsll #8,%d0
|
||||
orl %d0,%d2
|
||||
lsll #8,%d0
|
||||
orl %d0,%d2
|
||||
clrl %d0
|
||||
moveb %d2,%d0
|
||||
movel %d0,%d2
|
||||
lsll #8,%d0
|
||||
orl %d0,%d2
|
||||
lsll #8,%d0
|
||||
orl %d0,%d2
|
||||
lsll #8,%d0
|
||||
orl %d0,%d2
|
||||
|
||||
/* word align */
|
||||
movl %a0,%d0
|
||||
btst #0,%d0 | if (dst & 1)
|
||||
jeq Lbzalgndw |
|
||||
movb %d2,%a0@+ | *(char *)dst++ = X
|
||||
jeq .Lbzalgndw |
|
||||
movb %d2,(%a0)+ | *(char *)dst++ = X
|
||||
subql #1,%d1 | len--
|
||||
addql #1,%d0
|
||||
Lbzalgndw:
|
||||
.Lbzalgndw:
|
||||
#ifndef __mc68010__
|
||||
/* long word align */
|
||||
btst #1,%d0 | if (dst & 2)
|
||||
jeq Lbzalgndl |
|
||||
movw %d2,%a0@+ | *(short *)dst++ = X
|
||||
jeq .Lbzalgndl |
|
||||
movw %d2,(%a0)+ | *(short *)dst++ = X
|
||||
subql #2,%d1 | len -= 2
|
||||
Lbzalgndl:
|
||||
.Lbzalgndl:
|
||||
/* set by 8 longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #5,%d0 | cnt = len / 32
|
||||
jeq Lbzlong | if (cnt)
|
||||
jeq .Lbzlong | if (cnt)
|
||||
andl #31,%d1 | len %= 32
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbz32loop:
|
||||
movl %d2,%a0@+ | set 8 long words
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
movl %d2,%a0@+
|
||||
dbf %d0,Lbz32loop | till done
|
||||
.Lbz32loop:
|
||||
movl %d2,(%a0)+ | set 8 long words
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
movl %d2,(%a0)+
|
||||
#ifndef __mcoldfire__
|
||||
dbf %d0,.Lbz32loop | till done
|
||||
clrw %d0
|
||||
#endif
|
||||
subql #1,%d0
|
||||
jcc Lbz32loop
|
||||
jcc .Lbz32loop
|
||||
#endif /* !__mc68010__ */
|
||||
|
||||
Lbzlong:
|
||||
.Lbzlong:
|
||||
/* set by longwords */
|
||||
movel %d1,%d0
|
||||
lsrl #2,%d0 | cnt = len / 4
|
||||
jeq Lbzbyte | if (cnt)
|
||||
jeq .Lbzbyte | if (cnt)
|
||||
subql #1,%d0 | set up for dbf
|
||||
Lbzlloop:
|
||||
movl %d2,%a0@+ | clear longwords
|
||||
dbf %d0,Lbzlloop | till done
|
||||
.Lbzlloop:
|
||||
movl %d2,(%a0)+ | clear longwords
|
||||
#ifndef __mcoldfire__
|
||||
dbf %d0,.Lbzlloop | till done
|
||||
#endif
|
||||
#ifdef __mc68010__
|
||||
clrw %d0
|
||||
subql #1,%d0
|
||||
jcc Lbzlloop
|
||||
#endif /* __mc68010__ */
|
||||
#if defined(__m68010) || defined(__mcoldfire__)
|
||||
subql #1,%d0
|
||||
jcc .Lbzlloop
|
||||
#endif /* __mc68010__ || __mcoldfire__ */
|
||||
andl #3,%d1 | len %= 4
|
||||
jeq Lbzdone
|
||||
jeq .Lbzdone
|
||||
|
||||
subql #1,%d1 | set up for dbf
|
||||
Lbzbloop:
|
||||
movb %d2,%a0@+ | set bytes
|
||||
Lbzbyte:
|
||||
dbf %d1,Lbzbloop | till done
|
||||
Lbzdone:
|
||||
movl %sp@(8),%d0 | return destination
|
||||
.Lbzbloop:
|
||||
movb %d2,(%a0)+ | set bytes
|
||||
.Lbzbyte:
|
||||
#ifdef __mcoldfire__
|
||||
subql #1,%d1 | decrement
|
||||
jcc .Lbzbloop | till done
|
||||
#else
|
||||
dbf %d1,.Lbzbloop | till done
|
||||
#endif
|
||||
.Lbzdone:
|
||||
movl 8(%sp),%d0 | return destination
|
||||
#ifdef __SVR4_ABI__
|
||||
moveal %d0,%a0
|
||||
#endif
|
||||
movl %sp@+,%d2
|
||||
movl (%sp)+,%d2
|
||||
rts
|
||||
END(memset)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strcat.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
|
||||
/* $NetBSD: strcat.S,v 1.4 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,22 +39,23 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: strcat.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
|
||||
RCSID("$NetBSD: strcat.S,v 1.4 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(strcat)
|
||||
movl %sp@(8),%a0 | a0 = fromaddr
|
||||
movl %sp@(4),%d0 | return value is toaddr
|
||||
movl 8(%sp),%a0 | a0 = fromaddr
|
||||
movl 4(%sp),%d0 | return value is toaddr
|
||||
movl %d0,%a1 | a1 = toaddr
|
||||
Lslloop:
|
||||
tstb %a1@+ | null?
|
||||
jne Lslloop | no, keep going
|
||||
.Lslloop:
|
||||
tstb (%a1)+ | null?
|
||||
jne .Lslloop | no, keep going
|
||||
subql #1,%a1
|
||||
Lscloop:
|
||||
movb %a0@+,%a1@+ | copy a byte
|
||||
jne Lscloop | copied non-null, keep going
|
||||
.Lscloop:
|
||||
movb (%a0)+,(%a1)+ | copy a byte
|
||||
jne .Lscloop | copied non-null, keep going
|
||||
#ifdef __SVR4_ABI__
|
||||
moveal %d0,%a0
|
||||
#endif
|
||||
rts
|
||||
END(strcat)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strchr.S,v 1.2 2009/07/17 19:37:57 dsl Exp $ */
|
||||
/* $NetBSD: strchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,17 +39,17 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)index.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: strchr.S,v 1.2 2009/07/17 19:37:57 dsl Exp $")
|
||||
RCSID("$NetBSD: strchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(strchr)
|
||||
movl %sp@(4),%a0 | string
|
||||
movb %sp@(11),%d0 | char to look for
|
||||
movl 4(%sp),%a0 | string
|
||||
movb 11(%sp),%d0 | char to look for
|
||||
ixloop:
|
||||
cmpb %a0@,%d0 | found our char?
|
||||
cmpb (%a0),%d0 | found our char?
|
||||
jeq ixfound | yes, break out
|
||||
tstb %a0@+ | null?
|
||||
tstb (%a0)+ | null?
|
||||
jne ixloop | no, keep going
|
||||
moveq #0,%d0 | not found, return null
|
||||
#ifdef __SVR4_ABI__
|
||||
@@ -59,5 +59,6 @@ ixloop:
|
||||
ixfound:
|
||||
movl %a0,%d0 | found, return pointer
|
||||
rts
|
||||
END(strchr)
|
||||
|
||||
STRONG_ALIAS(index,strchr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strcmp.S,v 1.2 2008/04/28 20:22:52 martin Exp $ */
|
||||
/* $NetBSD: strcmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -33,39 +33,53 @@
|
||||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: strcmp.S,v 1.2 2008/04/28 20:22:52 martin Exp $")
|
||||
RCSID("$NetBSD: strcmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef __mcoldfire__
|
||||
#define GETC(a,b) mvsb a,b
|
||||
#define SUBC(a,b) mvsb a,%d0; subl %d0,b
|
||||
#else
|
||||
#define GETC(a,b) movb a,b
|
||||
#define SUBC(a,b) subb a,b
|
||||
#endif
|
||||
|
||||
ENTRY(strcmp)
|
||||
movl %sp@(4),%a0
|
||||
movl %sp@(8),%a1
|
||||
L1: /* unrolled by 4 for 680[23]0's */
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
movl 4(%sp),%a0
|
||||
movl 8(%sp),%a1
|
||||
.L1: /* unrolled by 4 for 680[23]0's */
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jeq L1
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jeq .L1
|
||||
|
||||
L3: scs %d0
|
||||
.L3:
|
||||
#ifdef __mcoldfire__
|
||||
movl %d1,%d0
|
||||
#else
|
||||
scs %d0
|
||||
EXTBL(%d0)
|
||||
movb %d1,%d0
|
||||
#endif
|
||||
rts
|
||||
|
||||
L2: movq #0,%d0
|
||||
movb %a1@,%d0
|
||||
.L2: movq #0,%d0
|
||||
movb (%a1),%d0
|
||||
negl %d0
|
||||
rts
|
||||
END(strcmp)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strcpy.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
|
||||
/* $NetBSD: strcpy.S,v 1.4 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,18 +39,19 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: strcpy.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
|
||||
RCSID("$NetBSD: strcpy.S,v 1.4 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(strcpy)
|
||||
movl %sp@(8),%a0 | a0 = fromaddr
|
||||
movl %sp@(4),%d0 | return value is toaddr
|
||||
movl 8(%sp),%a0 | a0 = fromaddr
|
||||
movl 4(%sp),%d0 | return value is toaddr
|
||||
movl %d0,%a1 | a1 = toaddr
|
||||
Lscloop:
|
||||
movb %a0@+,%a1@+ | copy a byte
|
||||
jne Lscloop | copied non-null, keep going
|
||||
.Lscloop:
|
||||
movb (%a0)+,(%a1)+ | copy a byte
|
||||
jne .Lscloop | copied non-null, keep going
|
||||
#ifdef __SVR4_ABI__
|
||||
moveal %d0,%a0
|
||||
#endif
|
||||
rts
|
||||
END(strcpy)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strlen.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
|
||||
/* $NetBSD: strlen.S,v 1.4 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,16 +39,17 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)strlen.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: strlen.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
|
||||
RCSID("$NetBSD: strlen.S,v 1.4 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(strlen)
|
||||
movl %sp@(4),%a0 | string
|
||||
movl 4(%sp),%a0 | string
|
||||
movl %a0,%d0
|
||||
notl %d0
|
||||
Lslloop:
|
||||
tstb %a0@+ | null?
|
||||
jne Lslloop | no, keep going
|
||||
.Lslloop:
|
||||
tstb (%a0)+ | null?
|
||||
jne .Lslloop | no, keep going
|
||||
addl %a0,%d0
|
||||
rts
|
||||
END(strlen)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strncmp.S,v 1.2 2008/04/28 20:22:52 martin Exp $ */
|
||||
/* $NetBSD: strncmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -33,46 +33,68 @@
|
||||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: strncmp.S,v 1.2 2008/04/28 20:22:52 martin Exp $")
|
||||
RCSID("$NetBSD: strncmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
||||
#ifdef __mcoldfire__
|
||||
#define GETC(a,b) mvsb a,b
|
||||
#define SUBC(a,b) mvsb a,%d2; subl %d2,b
|
||||
#else
|
||||
#define GETC(a,b) movb a,b
|
||||
#define SUBC(a,b) subb a,b
|
||||
#endif
|
||||
|
||||
ENTRY(strncmp)
|
||||
movl %sp@(12),%d0
|
||||
jeq L4
|
||||
movl %sp@(4),%a0
|
||||
movl %sp@(8),%a1
|
||||
L1: /* unroll by 4 for m680[23]0's */
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
movl 12(%sp),%d0
|
||||
jeq .L4
|
||||
movl 4(%sp),%a0
|
||||
movl 8(%sp),%a1
|
||||
#ifdef __coldfire__
|
||||
movl %d2,-(%sp) | save temp
|
||||
#endif
|
||||
.L1: /* unroll by 4 for m680[23]0's */
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
subql #1,%d0
|
||||
jeq L4
|
||||
jeq .L4
|
||||
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
subql #1,%d0
|
||||
jeq L4
|
||||
jeq .L4
|
||||
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
subql #1,%d0
|
||||
jeq L4
|
||||
jeq .L4
|
||||
|
||||
movb %a0@+,%d1
|
||||
jeq L2
|
||||
subb %a1@+,%d1
|
||||
jne L3
|
||||
GETC((%a0)+,%d1)
|
||||
jeq .L2
|
||||
SUBC((%a1)+,%d1)
|
||||
jne .L3
|
||||
subql #1,%d0
|
||||
jne L1
|
||||
L4: rts
|
||||
jne .L1
|
||||
#ifdef __mcoldfire__
|
||||
movl (%sp)+,%d2 | restore temp
|
||||
#endif
|
||||
.L4: rts
|
||||
|
||||
L2: subb %a1@,%d1
|
||||
L3: scs %d0
|
||||
.L2: SUBC((%a1),%d1)
|
||||
.L3:
|
||||
#ifdef __mcoldfire__
|
||||
movl (%sp)+,%d2 | restore temp
|
||||
movl %d1,%d0
|
||||
#else
|
||||
scs %d0
|
||||
EXTBL(%d0)
|
||||
movb %d1,%d0
|
||||
moveb %d1,%d0
|
||||
#endif
|
||||
rts
|
||||
END(strncmp)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strncpy.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
|
||||
/* $NetBSD: strncpy.S,v 1.5 2013/09/07 19:06:29 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,35 +39,42 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)strncpy.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: strncpy.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
|
||||
RCSID("$NetBSD: strncpy.S,v 1.5 2013/09/07 19:06:29 chs Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(strncpy)
|
||||
movl %sp@(4),%d0 | return value is toaddr
|
||||
movl %sp@(12),%d1 | count
|
||||
jeq Lscdone | nothing to do
|
||||
movl %sp@(8),%a0 | a0 = fromaddr
|
||||
movl 4(%sp),%d0 | return value is toaddr
|
||||
movl 12(%sp),%d1 | count
|
||||
jeq .Lscdone | nothing to do
|
||||
movl 8(%sp),%a0 | a0 = fromaddr
|
||||
movl %d0,%a1 | a1 = toaddr
|
||||
subql #1,%d1
|
||||
Lscloop:
|
||||
movb %a0@+,%a1@+ | copy a byte
|
||||
dbeq %d1,Lscloop | loop through low word of d1
|
||||
jeq Lscpadding | copied null, padding if necessary
|
||||
.Lscloop:
|
||||
movb (%a0)+,(%a1)+ | copy a byte
|
||||
#ifndef __mcoldfire__
|
||||
dbeq %d1,.Lscloop | loop through low word of d1
|
||||
#endif
|
||||
jeq .Lscpadding | copied null, padding if necessary
|
||||
#ifndef __mcoldfire__
|
||||
clrw %d1 | clear low word of d1
|
||||
#endif
|
||||
subql #1,%d1 | adjust count for long copies
|
||||
jcc Lscloop | more room, keep going
|
||||
Lscdone:
|
||||
jcc .Lscloop | more room, keep going
|
||||
.Lscdone:
|
||||
#ifdef __SVR4_ABI__
|
||||
moveal %d0,%a0
|
||||
#endif
|
||||
rts
|
||||
|
||||
Lscploop:
|
||||
clrb %a1@+ | clear a byte
|
||||
dbra %d1,Lscploop | keep going
|
||||
.Lscploop:
|
||||
clrb (%a1)+ | clear a byte
|
||||
#ifndef __mcoldfire__
|
||||
dbra %d1,.Lscploop | keep going
|
||||
clrw %d1
|
||||
Lscpadding:
|
||||
#endif
|
||||
.Lscpadding:
|
||||
subql #1,%d1
|
||||
jcc Lscploop
|
||||
jra Lscdone
|
||||
jcc .Lscploop
|
||||
jra .Lscdone
|
||||
END(strncpy)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strrchr.S,v 1.2 2009/07/17 19:37:57 dsl Exp $ */
|
||||
/* $NetBSD: strrchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@@ -39,22 +39,23 @@
|
||||
#if 0
|
||||
RCSID("from: @(#)rindex.s 5.1 (Berkeley) 5/12/90")
|
||||
#else
|
||||
RCSID("$NetBSD: strrchr.S,v 1.2 2009/07/17 19:37:57 dsl Exp $")
|
||||
RCSID("$NetBSD: strrchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $")
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
ENTRY(strrchr)
|
||||
movl %sp@(4),%a1 | string
|
||||
movb %sp@(11),%d0 | char to look for
|
||||
movl 4(%sp),%a1 | string
|
||||
movb 11(%sp),%d0 | char to look for
|
||||
subl %a0,%a0 | clear rindex pointer
|
||||
rixloop:
|
||||
cmpb %a1@,%d0 | found our char?
|
||||
cmpb (%a1),%d0 | found our char?
|
||||
jne rixnope | no, check for null
|
||||
movl %a1,%a0 | yes, remember location
|
||||
rixnope:
|
||||
tstb %a1@+ | null?
|
||||
tstb (%a1)+ | null?
|
||||
jne rixloop | no, keep going
|
||||
movl %a0,%d0 | return value
|
||||
rts
|
||||
END(strrchr)
|
||||
|
||||
STRONG_ALIAS(rindex,strrchr)
|
||||
|
||||
Reference in New Issue
Block a user