summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/string
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/i386/string')
-rw-r--r--lib/libc/i386/string/Makefile.inc7
-rw-r--r--lib/libc/i386/string/bcmp.S64
-rw-r--r--lib/libc/i386/string/bcopy.S108
-rw-r--r--lib/libc/i386/string/bzero.S82
-rw-r--r--lib/libc/i386/string/ffs.S54
-rw-r--r--lib/libc/i386/string/index.S64
-rw-r--r--lib/libc/i386/string/memchr.S59
-rw-r--r--lib/libc/i386/string/memcmp.S76
-rw-r--r--lib/libc/i386/string/memcpy.S5
-rw-r--r--lib/libc/i386/string/memmove.S5
-rw-r--r--lib/libc/i386/string/memset.S90
-rw-r--r--lib/libc/i386/string/rindex.S65
-rw-r--r--lib/libc/i386/string/strcat.S101
-rw-r--r--lib/libc/i386/string/strchr.S64
-rw-r--r--lib/libc/i386/string/strcmp.S120
-rw-r--r--lib/libc/i386/string/strcpy.S90
-rw-r--r--lib/libc/i386/string/strncmp.S167
-rw-r--r--lib/libc/i386/string/strrchr.S65
-rw-r--r--lib/libc/i386/string/swab.S100
-rw-r--r--lib/libc/i386/string/wcschr.S77
-rw-r--r--lib/libc/i386/string/wcscmp.S80
-rw-r--r--lib/libc/i386/string/wcslen.S69
-rw-r--r--lib/libc/i386/string/wmemchr.S106
23 files changed, 0 insertions, 1718 deletions
diff --git a/lib/libc/i386/string/Makefile.inc b/lib/libc/i386/string/Makefile.inc
deleted file mode 100644
index 3292267..0000000
--- a/lib/libc/i386/string/Makefile.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
-
-MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S index.S memchr.S memcmp.S memcpy.S \
- memmove.S memset.S rindex.S strcat.S strchr.S strcmp.S strcpy.S \
- strncmp.S strrchr.S swab.S wcschr.S wcscmp.S wcslen.S \
- wmemchr.S
diff --git a/lib/libc/i386/string/bcmp.S b/lib/libc/i386/string/bcmp.S
deleted file mode 100644
index eaf9666..0000000
--- a/lib/libc/i386/string/bcmp.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * bcmp (void *b1, void *b2, size_t len)
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(bcmp)
- pushl %edi
- pushl %esi
- movl 12(%esp),%edi
- movl 16(%esp),%esi
- cld /* set compare direction forward */
-
- movl 20(%esp),%ecx /* compare by words */
- shrl $2,%ecx
- repe
- cmpsl
- jne L1
-
- movl 20(%esp),%ecx /* compare remainder by bytes */
- andl $3,%ecx
- repe
- cmpsb
-L1:
- setne %al
- movsbl %al,%eax
- popl %esi
- popl %edi
- ret
-END(bcmp)
diff --git a/lib/libc/i386/string/bcopy.S b/lib/libc/i386/string/bcopy.S
deleted file mode 100644
index 2f3525e..0000000
--- a/lib/libc/i386/string/bcopy.S
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from locore.s.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if 0
- RCSID("$NetBSD: bcopy.S,v 1.6 1996/11/12 00:50:06 jtc Exp $")
-#endif
-
- /*
- * (ov)bcopy (src,dst,cnt)
- * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
- */
-
-#ifdef MEMCOPY
-ENTRY(memcpy)
-#else
-#ifdef MEMMOVE
-ENTRY(memmove)
-#else
-ENTRY(bcopy)
-#endif
-#endif
- pushl %esi
- pushl %edi
-#if defined(MEMCOPY) || defined(MEMMOVE)
- movl 12(%esp),%edi
- movl 16(%esp),%esi
- movl %edi,%eax
-#else
- movl 12(%esp),%esi
- movl 16(%esp),%edi
-#endif
- movl 20(%esp),%ecx
- movl %edi,%edx
- subl %esi,%edx
- cmpl %ecx,%edx /* overlapping? */
- jb 1f
- cld /* nope, copy forwards. */
- movl %ecx,%edx
- shrl $2,%ecx /* copy by words */
- rep
- movsl
- movl %edx,%ecx
- andl $3,%ecx /* any bytes left? */
- rep
- movsb
- popl %edi
- popl %esi
- ret
-1:
- addl %ecx,%edi /* copy backwards. */
- addl %ecx,%esi
- std
- movl %ecx,%edx
- andl $3,%ecx /* any fractional bytes? */
- decl %edi
- decl %esi
- rep
- movsb
- movl %edx,%ecx /* copy remainder by words */
- shrl $2,%ecx
- subl $3,%esi
- subl $3,%edi
- rep
- movsl
- popl %edi
- popl %esi
- cld
- ret
-#ifdef MEMCOPY
-END(memcpy)
-#else
-#ifdef MEMMOVE
-END(memmove)
-#else
-END(bcopy)
-#endif
-#endif
diff --git a/lib/libc/i386/string/bzero.S b/lib/libc/i386/string/bzero.S
deleted file mode 100644
index 3c22b36..0000000
--- a/lib/libc/i386/string/bzero.S
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * bzero (void *b, size_t len)
- * write len zero bytes to the string b.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(bzero)
- pushl %edi
- pushl %ebx
- movl 12(%esp),%edi
- movl 16(%esp),%ecx
-
- cld /* set fill direction forward */
- xorl %eax,%eax /* set fill data to 0 */
-
- /*
- * if the string is too short, it's really not worth the overhead
- * of aligning to word boundries, etc. So we jump to a plain
- * unaligned set.
- */
- cmpl $0x0f,%ecx
- jle L1
-
- movl %edi,%edx /* compute misalignment */
- negl %edx
- andl $3,%edx
- movl %ecx,%ebx
- subl %edx,%ebx
-
- movl %edx,%ecx /* zero until word aligned */
- rep
- stosb
-
- movl %ebx,%ecx /* zero by words */
- shrl $2,%ecx
- rep
- stosl
-
- movl %ebx,%ecx
- andl $3,%ecx /* zero remainder by bytes */
-L1: rep
- stosb
-
- popl %ebx
- popl %edi
- ret
-END(bzero)
diff --git a/lib/libc/i386/string/ffs.S b/lib/libc/i386/string/ffs.S
deleted file mode 100644
index e668447..0000000
--- a/lib/libc/i386/string/ffs.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * ffs(value)
- * finds the first bit set in value and returns the index of
- * that bit. Bits are numbered starting from 1, starting at the
- * rightmost bit. A return value of 0 means that the argument
- * was zero.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(ffs)
- bsfl 4(%esp),%eax
- jz L1 /* ZF is set if all bits are 0 */
- incl %eax /* bits numbered from 1, not 0 */
- ret
-
- .align 2
-L1: xorl %eax,%eax /* clear result */
- ret
-END(ffs)
diff --git a/lib/libc/i386/string/index.S b/lib/libc/i386/string/index.S
deleted file mode 100644
index e7e7a8c..0000000
--- a/lib/libc/i386/string/index.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * index(s, c)
- * return a pointer to the first occurance of the character c in
- * string s, or NULL if c does not occur in the string.
- *
- * %edx - pointer iterating through string
- * %eax - pointer to first occurance of 'c'
- * %cl - character we're comparing against
- * %bl - character at %edx
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(index)
- pushl %ebx
- movl 8(%esp),%eax
- movb 12(%esp),%cl
- .align 2,0x90
-L1:
- movb (%eax),%bl
- cmpb %bl,%cl /* found char??? */
- je L2
- incl %eax
- testb %bl,%bl /* null terminator??? */
- jne L1
- xorl %eax,%eax
-L2:
- popl %ebx
- ret
-END(index)
diff --git a/lib/libc/i386/string/memchr.S b/lib/libc/i386/string/memchr.S
deleted file mode 100644
index a313d4d..0000000
--- a/lib/libc/i386/string/memchr.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * memchr (b, c, len)
- * locates the first occurance of c in string b.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(memchr)
- pushl %edi
- movl 8(%esp),%edi /* string address */
- movl 12(%esp),%eax /* set character to search for */
- movl 16(%esp),%ecx /* set length of search */
- testl %esp,%esp /* clear Z flag, for len == 0 */
- cld /* set search forward */
- repne /* search! */
- scasb
- jnz L1 /* scan failed, return null */
- leal -1(%edi),%eax /* adjust result of scan */
- popl %edi
- ret
- .align 2,0x90
-L1: xorl %eax,%eax
- popl %edi
- ret
-END(memchr)
diff --git a/lib/libc/i386/string/memcmp.S b/lib/libc/i386/string/memcmp.S
deleted file mode 100644
index fa9586f..0000000
--- a/lib/libc/i386/string/memcmp.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * memcmp (void *b1, void *b2, size_t len)
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(memcmp)
- pushl %edi
- pushl %esi
- movl 12(%esp),%edi
- movl 16(%esp),%esi
- cld /* set compare direction forward */
-
- movl 20(%esp),%ecx /* compare by words */
- shrl $2,%ecx
- repe
- cmpsl
- jne L5 /* do we match so far? */
-
- movl 20(%esp),%ecx /* compare remainder by bytes */
- andl $3,%ecx
- repe
- cmpsb
- jne L6 /* do we match? */
-
- xorl %eax,%eax /* we match, return zero */
- popl %esi
- popl %edi
- ret
-
-L5: movl $4,%ecx /* We know that one of the next */
- subl %ecx,%edi /* four pairs of bytes do not */
- subl %ecx,%esi /* match. */
- repe
- cmpsb
-L6: movzbl -1(%edi),%eax /* Perform unsigned comparison */
- movzbl -1(%esi),%edx
- subl %edx,%eax
- popl %esi
- popl %edi
- ret
-END(memcmp)
diff --git a/lib/libc/i386/string/memcpy.S b/lib/libc/i386/string/memcpy.S
deleted file mode 100644
index f85a1a5..0000000
--- a/lib/libc/i386/string/memcpy.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define MEMCOPY
-#include "bcopy.S"
diff --git a/lib/libc/i386/string/memmove.S b/lib/libc/i386/string/memmove.S
deleted file mode 100644
index 02330c4..0000000
--- a/lib/libc/i386/string/memmove.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define MEMMOVE
-#include "bcopy.S"
diff --git a/lib/libc/i386/string/memset.S b/lib/libc/i386/string/memset.S
deleted file mode 100644
index 25768c22..0000000
--- a/lib/libc/i386/string/memset.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * memset(void *b, int c, size_t len)
- * write len bytes of value c (converted to an unsigned char) to
- * the string b.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(memset)
- pushl %edi
- pushl %ebx
- movl 12(%esp),%edi
- movzbl 16(%esp),%eax /* unsigned char, zero extend */
- movl 20(%esp),%ecx
- pushl %edi /* push address of buffer */
-
- cld /* set fill direction forward */
-
- /*
- * if the string is too short, it's really not worth the overhead
- * of aligning to word boundries, etc. So we jump to a plain
- * unaligned set.
- */
- cmpl $0x0f,%ecx
- jle L1
-
- movb %al,%ah /* copy char to all bytes in word */
- movl %eax,%edx
- sall $16,%eax
- orl %edx,%eax
-
- movl %edi,%edx /* compute misalignment */
- negl %edx
- andl $3,%edx
- movl %ecx,%ebx
- subl %edx,%ebx
-
- movl %edx,%ecx /* set until word aligned */
- rep
- stosb
-
- movl %ebx,%ecx
- shrl $2,%ecx /* set by words */
- rep
- stosl
-
- movl %ebx,%ecx /* set remainder by bytes */
- andl $3,%ecx
-L1: rep
- stosb
-
- popl %eax /* pop address of buffer */
- popl %ebx
- popl %edi
- ret
-END(memset)
diff --git a/lib/libc/i386/string/rindex.S b/lib/libc/i386/string/rindex.S
deleted file mode 100644
index c52f6d3..0000000
--- a/lib/libc/i386/string/rindex.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * rindex(s, c)
- * return a pointer to the last occurance of the character c in
- * string s, or NULL if c does not occur in the string.
- *
- * %edx - pointer iterating through string
- * %eax - pointer to last occurance of 'c'
- * %cl - character we're comparing against
- * %bl - character at %edx
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(rindex)
- pushl %ebx
- movl 8(%esp),%edx
- movb 12(%esp),%cl
- xorl %eax,%eax /* init pointer to null */
- .align 2,0x90
-L1:
- movb (%edx),%bl
- cmpb %bl,%cl
- jne L2
- movl %edx,%eax
-L2:
- incl %edx
- testb %bl,%bl /* null terminator??? */
- jne L1
- popl %ebx
- ret
-END(rindex)
diff --git a/lib/libc/i386/string/strcat.S b/lib/libc/i386/string/strcat.S
deleted file mode 100644
index 6715bd8..0000000
--- a/lib/libc/i386/string/strcat.S
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * strcat(s, append)
- * append a copy of the null-terminated string "append" to the end
- * of the null-terminated string s, then add a terminating `\0'.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-/*
- * I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcat)
- pushl %edi /* save edi */
- movl 8(%esp),%edi /* dst address */
- movl 12(%esp),%edx /* src address */
- pushl %edi /* push destination address */
-
- cld /* set search forward */
- xorl %eax,%eax /* set search for null terminator */
- movl $-1,%ecx /* set search for lots of characters */
- repne /* search! */
- scasb
-
- leal -1(%edi),%ecx /* correct dst address */
-
- .align 2,0x90
-L1: movb (%edx),%al /* unroll loop, but not too much */
- movb %al,(%ecx)
- testb %al,%al
- je L2
- movb 1(%edx),%al
- movb %al,1(%ecx)
- testb %al,%al
- je L2
- movb 2(%edx),%al
- movb %al,2(%ecx)
- testb %al,%al
- je L2
- movb 3(%edx),%al
- movb %al,3(%ecx)
- testb %al,%al
- je L2
- movb 4(%edx),%al
- movb %al,4(%ecx)
- testb %al,%al
- je L2
- movb 5(%edx),%al
- movb %al,5(%ecx)
- testb %al,%al
- je L2
- movb 6(%edx),%al
- movb %al,6(%ecx)
- testb %al,%al
- je L2
- movb 7(%edx),%al
- movb %al,7(%ecx)
- addl $8,%edx
- addl $8,%ecx
- testb %al,%al
- jne L1
-L2: popl %eax /* pop destination address */
- popl %edi /* restore edi */
- ret
-END(strcat)
diff --git a/lib/libc/i386/string/strchr.S b/lib/libc/i386/string/strchr.S
deleted file mode 100644
index 8c518fb..0000000
--- a/lib/libc/i386/string/strchr.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * strchr(s, c)
- * return a pointer to the first occurance of the character c in
- * string s, or NULL if c does not occur in the string.
- *
- * %edx - pointer iterating through string
- * %eax - pointer to first occurance of 'c'
- * %cl - character we're comparing against
- * %bl - character at %edx
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(strchr)
- pushl %ebx
- movl 8(%esp),%eax
- movb 12(%esp),%cl
- .align 2,0x90
-L1:
- movb (%eax),%bl
- cmpb %bl,%cl /* found char??? */
- je L2
- incl %eax
- testb %bl,%bl /* null terminator??? */
- jne L1
- xorl %eax,%eax
-L2:
- popl %ebx
- ret
-END(strchr)
diff --git a/lib/libc/i386/string/strcmp.S b/lib/libc/i386/string/strcmp.S
deleted file mode 100644
index 9ca104e..0000000
--- a/lib/libc/i386/string/strcmp.S
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * strcmp(s1, s2)
- * return an integer greater than, equal to, or less than 0,
- * according as string s1 is greater than, equal to, or less
- * than the string s2.
- *
- * %eax - pointer to s1
- * %edx - pointer to s2
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-/*
- * I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcmp)
- movl 0x04(%esp),%eax
- movl 0x08(%esp),%edx
- jmp L2 /* Jump into the loop! */
-
- .align 2,0x90
-L1: incl %eax
- incl %edx
-L2: movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- jne L3
- incl %eax
- incl %edx
- movb (%eax),%cl
- testb %cl,%cl
- je L3
- cmpb %cl,(%edx)
- je L1
- .align 2, 0x90
-L3: movzbl (%eax),%eax /* unsigned comparison */
- movzbl (%edx),%edx
- subl %edx,%eax
- ret
-END(strcmp)
diff --git a/lib/libc/i386/string/strcpy.S b/lib/libc/i386/string/strcpy.S
deleted file mode 100644
index 7367c07..0000000
--- a/lib/libc/i386/string/strcpy.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * strcpy (dst, src)
- * copy the string src to dst.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-/*
- * I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcpy)
- movl 4(%esp),%ecx /* dst address */
- movl 8(%esp),%edx /* src address */
- pushl %ecx /* push dst address */
-
- .align 2,0x90
-L1: movb (%edx),%al /* unroll loop, but not too much */
- movb %al,(%ecx)
- testb %al,%al
- je L2
- movb 1(%edx),%al
- movb %al,1(%ecx)
- testb %al,%al
- je L2
- movb 2(%edx),%al
- movb %al,2(%ecx)
- testb %al,%al
- je L2
- movb 3(%edx),%al
- movb %al,3(%ecx)
- testb %al,%al
- je L2
- movb 4(%edx),%al
- movb %al,4(%ecx)
- testb %al,%al
- je L2
- movb 5(%edx),%al
- movb %al,5(%ecx)
- testb %al,%al
- je L2
- movb 6(%edx),%al
- movb %al,6(%ecx)
- testb %al,%al
- je L2
- movb 7(%edx),%al
- movb %al,7(%ecx)
- addl $8,%edx
- addl $8,%ecx
- testb %al,%al
- jne L1
-L2: popl %eax /* pop dst address */
- ret
-END(strcpy)
diff --git a/lib/libc/i386/string/strncmp.S b/lib/libc/i386/string/strncmp.S
deleted file mode 100644
index 98e3656..0000000
--- a/lib/libc/i386/string/strncmp.S
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 1993,94 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * strncmp(s1, s2, n)
- * return an integer greater than, equal to, or less than 0,
- * according as the first n characters of string s1 is greater
- * than, equal to, or less than the string s2.
- *
- * %eax - pointer to s1
- * %ecx - pointer to s2
- * %edx - length
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-/*
- * I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- *
- * TODO: change all the jz's back to je for consistency.
- */
-
-ENTRY(strncmp)
- pushl %ebx
- movl 8(%esp),%eax
- movl 12(%esp),%ecx
- movl 16(%esp),%edx
- testl %edx,%edx
- jmp L2 /* Jump into the loop! */
-
- .align 2,0x90
-L1: incl %eax
- incl %ecx
- decl %edx
-L2: jz L4 /* strings are equal */
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
-/*
- * XXX it might be best to move the next 4 instructions to the end of the
- * unrolled part of the loop. The unrolled part would then be
- * movb n(%eax),%bl; testb %bl, %bl; je L3; cmpb n(%ecx); jne L3
- * or maybe better
- * movb n(%eax),%bl; cmpb n(%ecx); jne L3; testb %bl,%bl; je return_0
- * for n = 0, 1, ..., 8. The end of the loop would be
- * L1: addl $8,%eax; addl $8,%ecx; subl $8,%edx; cmpl $8,%edx; jae Lx
- * where residual counts of 0 to 7 are handled at Lx. However, this would
- * be slower for short strings. Cache effects are probably not so
- * important because we are only handling a byte at a time.
- */
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- jne L3
-
- incl %eax
- incl %ecx
- decl %edx
- jz L4
- movb (%eax),%bl
- testb %bl,%bl
- jz L3
- cmpb %bl,(%ecx)
- je L1
-
- .align 2,0x90
-L3: movzbl (%eax),%eax /* unsigned comparison */
- movzbl (%ecx),%ecx
- subl %ecx,%eax
- popl %ebx
- ret
- .align 2,0x90
-L4: xorl %eax,%eax
- popl %ebx
- ret
-END(strncmp)
diff --git a/lib/libc/i386/string/strrchr.S b/lib/libc/i386/string/strrchr.S
deleted file mode 100644
index f044c2e..0000000
--- a/lib/libc/i386/string/strrchr.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * strrchr(s, c)
- * return a pointer to the last occurance of the character c in
- * string s, or NULL if c does not occur in the string.
- *
- * %edx - pointer iterating through string
- * %eax - pointer to last occurance of 'c'
- * %cl - character we're comparing against
- * %bl - character at %edx
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(strrchr)
- pushl %ebx
- movl 8(%esp),%edx
- movb 12(%esp),%cl
- xorl %eax,%eax /* init pointer to null */
- .align 2,0x90
-L1:
- movb (%edx),%bl
- cmpb %bl,%cl
- jne L2
- movl %edx,%eax
-L2:
- incl %edx
- testb %bl,%bl /* null terminator??? */
- jne L1
- popl %ebx
- ret
-END(strrchr)
diff --git a/lib/libc/i386/string/swab.S b/lib/libc/i386/string/swab.S
deleted file mode 100644
index 5035de2..0000000
--- a/lib/libc/i386/string/swab.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 1993,94 Winning Strategies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * void
- * swab (const void *src, void *dst, size_t len)
- * copy len bytes from src to dst, swapping adjacent bytes
- *
- * On the i486, this code is negligibly faster than the code generated
- * by gcc at about half the size. If my i386 databook is correct, it
- * should be considerably faster than the gcc code on an i386.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(swab)
- pushl %esi
- pushl %edi
- movl 12(%esp),%esi
- movl 16(%esp),%edi
- movl 20(%esp),%ecx
-
- cld # set direction forward
-
- shrl $1,%ecx
- testl $7,%ecx # copy first group of 1 to 7 words
- jz L2 # while swaping alternate bytes.
- .align 2,0x90
-L1: lodsw
- rorw $8,%ax
- stosw
- decl %ecx
- testl $7,%ecx
- jnz L1
-
-L2: shrl $3,%ecx # copy remainder 8 words at a time
- jz L4 # while swapping alternate bytes.
- .align 2,0x90
-L3: lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- lodsw
- rorw $8,%ax
- stosw
- decl %ecx
- jnz L3
-
-L4: popl %edi
- popl %esi
- ret
-END(swab)
diff --git a/lib/libc/i386/string/wcschr.S b/lib/libc/i386/string/wcschr.S
deleted file mode 100644
index 8f6c543..0000000
--- a/lib/libc/i386/string/wcschr.S
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * wchar_t *
- * wcschr(const wchar_t *s, wchar_t c) --
- * Return pointer to first occurrence of the character `c' in the wide
- * character string `s', or NULL if not found.
- */
-ENTRY(wcschr)
- movl 4(%esp),%ecx /* String */
- movl 8(%esp),%eax /* Character */
- pushl %ebx
-.p2align 4,0x90
-L1: movl (%ecx),%ebx
- cmpl %eax,%ebx
- je found0
- testl %ebx,%ebx
- jz no
- movl 4(%ecx),%ebx
- cmpl %eax,%ebx
- je found1
- testl %ebx,%ebx
- jz no
- movl 8(%ecx),%ebx
- cmpl %eax,%ebx
- je found2
- testl %ebx,%ebx
- jz no
- movl 12(%ecx),%ebx
- cmpl %eax,%ebx
- je found3
- testl %ebx,%ebx
- jz no
- leal 16(%ecx),%ecx
- jmp L1
-.p2align 2,0x90
-found3: leal 4(%ecx),%ecx
-.p2align 2,0x90
-found2: leal 4(%ecx),%ecx
-.p2align 2,0x90
-found1: leal 4(%ecx),%ecx
-.p2align 2,0x90
-found0: popl %ebx
- movl %ecx,%eax
- ret
-.p2align 2,0x90
-no: popl %ebx
- xorl %eax,%eax
- ret
-END(wcschr)
diff --git a/lib/libc/i386/string/wcscmp.S b/lib/libc/i386/string/wcscmp.S
deleted file mode 100644
index 8d0700a..0000000
--- a/lib/libc/i386/string/wcscmp.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * int
- * wcscmp(const wchar_t *s1, const wchar_t *s2) --
- * Return an integer greater than, equal to, or less than 0, when
- * the string s1 is greater than, equal to, or less than the string s2.
- */
-ENTRY(wcscmp)
- pushl %edi
- pushl %esi
- movl 12(%esp),%edi /* s1 */
- movl 16(%esp),%esi /* s2 */
-.p2align 4,0x90
-top: movl (%edi),%eax
- cmpl %eax,(%esi)
- jne no0
- testl %eax,%eax
- jz same
- movl 4(%edi),%eax
- cmpl %eax,4(%esi)
- jne no4
- testl %eax,%eax
- jz same
- movl 8(%edi),%eax
- cmpl %eax,8(%esi)
- jne no8
- testl %eax,%eax
- jz same
- movl 12(%edi),%eax
- cmpl %eax,12(%esi)
- jne no12
- leal 16(%edi),%edi
- leal 16(%esi),%esi
- testl %eax,%eax
- jnz top
-.p2align 2,0x90
-same: xorl %eax,%eax
- popl %esi
- popl %edi
- ret
-.p2align 2,0x90
-no12: leal 4(%esi),%esi
-.p2align 2,0x90
-no8: leal 4(%esi),%esi
-.p2align 2,0x90
-no4: leal 4(%esi),%esi
-.p2align 2,0x90
-no0: subl (%esi),%eax
- popl %esi
- popl %edi
- ret
-END(wcscmp)
diff --git a/lib/libc/i386/string/wcslen.S b/lib/libc/i386/string/wcslen.S
deleted file mode 100644
index 9fea2b0..0000000
--- a/lib/libc/i386/string/wcslen.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * size_t
- * wcslen(const wchar_t *s) --
- * Find the length of a wide character string.
- */
-ENTRY(wcslen)
- movl 4(%esp),%ecx /* String */
- pushl %ebx
- xorl %ebx,%ebx
- xorl %eax,%eax
-.p2align 4,0x90
-L1: cmpl %ebx,(%ecx)
- jz found0
- cmpl %ebx,4(%ecx)
- jz found1
- cmpl %ebx,8(%ecx)
- jz found2
- cmpl %ebx,12(%ecx)
- jz found3
- cmpl %ebx,16(%ecx)
- jz found4
- cmpl %ebx,20(%ecx)
- jz found5
- cmpl %ebx,24(%ecx)
- jz found6
- cmpl %ebx,28(%ecx)
- jz found7
- leal 32(%ecx),%ecx
- addl $8,%eax
- jmp L1
-found7: incl %eax
-found6: incl %eax
-found5: incl %eax
-found4: incl %eax
-found3: incl %eax
-found2: incl %eax
-found1: incl %eax
-found0: popl %ebx
- ret
-END(wcslen)
diff --git a/lib/libc/i386/string/wmemchr.S b/lib/libc/i386/string/wmemchr.S
deleted file mode 100644
index 2b5270b..0000000
--- a/lib/libc/i386/string/wmemchr.S
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * wchar_t *
- * wmemchr(const wchar_t *buf, wchar_t c, size_t n) --
- * Search the wide character array `buf', which has length `n',
- * the character `c', return a pointer to it if found, or NULL on
- * failure.
- */
-ENTRY(wmemchr)
- pushl %edi
- pushl %ebx
- movl 12(%esp),%edi /* Buffer */
- movl 16(%esp),%eax /* Wide character */
- movl 20(%esp),%ecx /* Length of buffer */
-
- /*
- * Search in chunks of 8 wide characters (32 bytes).
- */
- movl %ecx,%ebx
- shrl $3,%ecx
- jz small
-.p2align 4,0x90
-bigloop:cmpl %eax,(%edi)
- je found
- cmpl %eax,4(%edi)
- je found4
- cmpl %eax,8(%edi)
- je found8
- cmpl %eax,12(%edi)
- je found12
- cmpl %eax,16(%edi)
- je found16
- cmpl %eax,20(%edi)
- je found20
- cmpl %eax,24(%edi)
- je found24
- cmpl %eax,28(%edi)
- je found28
- leal 32(%edi),%edi
- decl %ecx
- jnz bigloop
- jmp small
-found: movl %edi,%eax
- popl %ebx
- popl %edi
- ret
-found4: leal 4(%edi),%edi
- jmp found
-found8: leal 8(%edi),%edi
- jmp found
-found12:leal 12(%edi),%edi
- jmp found
-found16:leal 16(%edi),%edi
- jmp found
-found20:leal 20(%edi),%edi
- jmp found
-found24:leal 24(%edi),%edi
- jmp found
-found28:leal 28(%edi),%edi
- jmp found
-
- /*
- * Search remaining part of string.
- */
-small: movl %ebx,%ecx
- andl $7,%ecx
- jz no
-.p2align 2,0x90
-smltop: cmpl %eax,(%edi)
- je found
- leal 4(%edi),%edi
- decl %ecx
- jnz smltop
-no: xorl %eax,%eax
- popl %ebx
- popl %edi
- ret
-END(wmemchr)
OpenPOWER on IntegriCloud