summaryrefslogtreecommitdiff
path: root/lib/libc/i386
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/i386')
-rw-r--r--lib/libc/i386/DEFS.h2
-rw-r--r--lib/libc/i386/string/bcmp.S11
-rw-r--r--lib/libc/i386/string/memcmp.S15
-rw-r--r--lib/libc/i386/string/memmove.S17
-rw-r--r--lib/libc/i386/string/memset.S16
-rw-r--r--lib/libc/i386/string/strcmp.S4
-rw-r--r--lib/libc/i386/string/strncmp.S69
7 files changed, 65 insertions, 69 deletions
diff --git a/lib/libc/i386/DEFS.h b/lib/libc/i386/DEFS.h
index 4b4df3e68ccb..6df18a13def7 100644
--- a/lib/libc/i386/DEFS.h
+++ b/lib/libc/i386/DEFS.h
@@ -35,7 +35,7 @@
*
* from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
*
- * $Id: DEFS.h,v 1.3.2.1 1994/05/04 08:44:15 rgrimes Exp $
+ * $Id: DEFS.h,v 1.4 1994/05/03 16:29:13 jkh Exp $
*/
/* XXX should use align 4,0x90 for -m486. */
diff --git a/lib/libc/i386/string/bcmp.S b/lib/libc/i386/string/bcmp.S
index 21027dadd8b4..d19922498d88 100644
--- a/lib/libc/i386/string/bcmp.S
+++ b/lib/libc/i386/string/bcmp.S
@@ -14,7 +14,7 @@
* 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 withough specific prior written permission
+ * 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
@@ -27,11 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: bcmp.S,v 1.1 1993/12/05 13:01:40 ats Exp $
+ * $Id: bcmp.S,v 1.2 1994/03/31 14:10:57 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: bcmp.S,v 1.1 1993/12/05 13:01:40 ats Exp $"
+ .asciz "$Id: bcmp.S,v 1.2 1994/03/31 14:10:57 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -48,17 +48,16 @@ ENTRY(bcmp)
pushl %esi
movl 12(%esp),%edi
movl 16(%esp),%esi
- movl 20(%esp),%edx
xorl %eax,%eax /* clear return value */
cld /* set compare direction forward */
- movl %edx,%ecx /* compare by words */
+ movl 20(%esp),%ecx /* compare by words */
shrl $2,%ecx
repe
cmpsl
jne L1
- movl %edx,%ecx /* compare remainder by bytes */
+ movl 20(%esp),%ecx /* compare remainder by bytes */
andl $3,%ecx
repe
cmpsb
diff --git a/lib/libc/i386/string/memcmp.S b/lib/libc/i386/string/memcmp.S
index e1fdaaa31f6e..5e74a7373235 100644
--- a/lib/libc/i386/string/memcmp.S
+++ b/lib/libc/i386/string/memcmp.S
@@ -14,7 +14,7 @@
* 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 withough specific prior written permission
+ * 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
@@ -27,11 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: memcmp.S,v 1.1.2.1 1994/03/07 02:19:34 rgrimes Exp $
+ * $Id: memcmp.S,v 1.3 1994/03/31 14:10:59 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: memcmp.S,v 1.1.2.1 1994/03/07 02:19:34 rgrimes Exp $"
+ .asciz "$Id: memcmp.S,v 1.3 1994/03/31 14:10:59 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -48,16 +48,15 @@ ENTRY(memcmp)
pushl %esi
movl 12(%esp),%edi
movl 16(%esp),%esi
- movl 20(%esp),%edx
cld /* set compare direction forward */
- movl %edx,%ecx /* compare by words */
+ movl 20(%esp),%ecx /* compare by words */
shrl $2,%ecx
repe
cmpsl
jne L5 /* do we match so far? */
- movl %edx,%ecx /* compare remainder by bytes */
+ movl 20(%esp),%ecx /* compare remainder by bytes */
andl $3,%ecx
repe
cmpsb
@@ -73,8 +72,8 @@ L5: movl $4,%ecx /* We know that one of the next */
subl %ecx,%esi /* match. */
repe
cmpsb
-L6: movzbl -1(%edi),%eax /* Perform unsigned comparison */
- movzbl -1(%esi),%edx
+L6: movzbl -1(%edi),%eax /* Perform unsigned comparison */
+ movzbl -1(%esi),%edx
subl %edx,%eax
popl %esi
popl %edi
diff --git a/lib/libc/i386/string/memmove.S b/lib/libc/i386/string/memmove.S
index 57e52ad04295..7eeec5bd8c21 100644
--- a/lib/libc/i386/string/memmove.S
+++ b/lib/libc/i386/string/memmove.S
@@ -32,11 +32,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: memmove.S,v 1.1 1993/12/05 13:01:50 ats Exp $
+ * $Id: memmove.S,v 1.2 1994/03/31 14:11:00 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: memmove.S,v 1.1 1993/12/05 13:01:50 ats Exp $"
+ .asciz "$Id: memmove.S,v 1.2 1994/03/31 14:11:00 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -51,20 +51,19 @@ ENTRY(memmove)
pushl %esi
pushl %edi
movl 12(%esp),%edi
- pushl %edi
- movl 20(%esp),%esi
- movl 24(%esp),%ecx
+ movl 16(%esp),%esi
+ movl 20(%esp),%ecx
cmpl %esi,%edi /* potentially overlapping? */
jnb 1f
cld /* nope, copy forwards. */
shrl $2,%ecx /* copy by words */
rep
movsl
- movl 24(%esp),%ecx
+ movl 20(%esp),%ecx
andl $3,%ecx /* any bytes left? */
rep
movsb
- popl %eax
+ movl 12(%esp),%eax
popl %edi
popl %esi
ret
@@ -77,13 +76,13 @@ ENTRY(memmove)
decl %esi
rep
movsb
- movl 24(%esp),%ecx /* copy remainder by words */
+ movl 20(%esp),%ecx /* copy remainder by words */
shrl $2,%ecx
subl $3,%esi
subl $3,%edi
rep
movsl
- popl %eax
+ movl 12(%esp),%eax
popl %edi
popl %esi
cld
diff --git a/lib/libc/i386/string/memset.S b/lib/libc/i386/string/memset.S
index 47e763781932..b7fc069da3c5 100644
--- a/lib/libc/i386/string/memset.S
+++ b/lib/libc/i386/string/memset.S
@@ -14,7 +14,7 @@
* 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 withough specific prior written permission
+ * 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
@@ -27,11 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: memset.S,v 1.1 1993/12/05 13:01:53 ats Exp $
+ * $Id: memset.S,v 1.2 1994/03/31 14:11:01 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: memset.S,v 1.1 1993/12/05 13:01:53 ats Exp $"
+ .asciz "$Id: memset.S,v 1.2 1994/03/31 14:11:01 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -57,17 +57,15 @@ ENTRY(memset)
/*
* 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
+ * of aligning to word boundries, etc. So we jump to a plain
* unaligned set.
*/
cmpl $0x0f,%ecx
jle L1
- movl %eax,%edx /* copy value to all bytes in word */
- sall $8,%edx /* XXX is there a better way? */
- orl %edx,%eax
+ movb %al,%ah /* copy char to all bytes in word */
movl %eax,%edx
- sall $16,%edx
+ sall $16,%eax
orl %edx,%eax
movl %edi,%edx /* compute misalignment */
@@ -75,7 +73,7 @@ ENTRY(memset)
andl $3,%edx
movl %ecx,%ebx
subl %edx,%ebx
-
+
movl %edx,%ecx /* set until word aligned */
rep
stosb
diff --git a/lib/libc/i386/string/strcmp.S b/lib/libc/i386/string/strcmp.S
index 015c21aa7fa3..bdc4585aed2f 100644
--- a/lib/libc/i386/string/strcmp.S
+++ b/lib/libc/i386/string/strcmp.S
@@ -27,11 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: strcmp.S,v 1.1.2.1 1994/03/07 02:19:31 rgrimes Exp $
+ * $Id: strcmp.S,v 1.2 1994/03/04 15:50:28 ache Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: strcmp.S,v 1.1.2.1 1994/03/07 02:19:31 rgrimes Exp $"
+ .asciz "$Id: strcmp.S,v 1.2 1994/03/04 15:50:28 ache Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
diff --git a/lib/libc/i386/string/strncmp.S b/lib/libc/i386/string/strncmp.S
index 72922fb30fec..a4df8025bfb5 100644
--- a/lib/libc/i386/string/strncmp.S
+++ b/lib/libc/i386/string/strncmp.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1993 Winning Strategies, Inc.
+ * Copyright (c) 1993,94 Winning Strategies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* 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 withough specific prior written permission
+ * 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
@@ -27,20 +27,20 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: strncmp.S,v 1.1.2.1 1994/03/07 02:19:33 rgrimes Exp $
+ * $Id: strncmp.S,v 1.3 1994/03/31 14:11:02 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: strncmp.S,v 1.1.2.1 1994/03/07 02:19:33 rgrimes Exp $"
+ .asciz "$Id: strncmp.S,v 1.3 1994/03/31 14:11:02 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
/*
- * strncmp(s1, s2, n)
- * return an integer greater than, equal to, or less than 0,
+ * 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.
+ * than, equal to, or less than the string s2.
*
* %eax - pointer to s1
* %ecx - pointer to s2
@@ -53,7 +53,7 @@
/*
* I've unrolled the loop eight times: large enough to make a
* significant difference, and small enough not to totally trash the
- * cashe.
+ * cache.
*/
ENTRY(strncmp)
@@ -61,92 +61,93 @@ ENTRY(strncmp)
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: testl %edx,%edx /* Have we compared n chars yet? */
- jle L4 /* Yes, strings are equal */
+L2: jz L4 /* strings are equal */
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
jne L3
+
incl %eax
incl %ecx
decl %edx
- testl %edx,%edx
- jle L4
+ jz L4
movb (%eax),%bl
testb %bl,%bl
- je L3
+ jz L3
cmpb %bl,(%ecx)
je L1
+
.align 2,0x90
-L3: movzbl (%eax),%eax /* unsigned comparision */
- movzbl (%ecx),%ecx
+L3: movzbl (%eax),%eax /* unsigned comparision */
+ movzbl (%ecx),%ecx
subl %ecx,%eax
popl %ebx
ret