diff options
| author | David Greenman <dg@FreeBSD.org> | 1995-12-27 18:47:45 +0000 |
|---|---|---|
| committer | David Greenman <dg@FreeBSD.org> | 1995-12-27 18:47:45 +0000 |
| commit | aacd7f348ef1258979f10dafbcf6d71c140a892f (patch) | |
| tree | 6c2961ce400b6ccc62cd0e124f7a530d8372d5bb /lib | |
| parent | dfe11c5d9d7d3af1a6859e7ebe8dc258865ec0e5 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/i386/string/bcopy.S | 14 | ||||
| -rw-r--r-- | lib/libc/i386/string/memmove.S | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/lib/libc/i386/string/bcopy.S b/lib/libc/i386/string/bcopy.S index 1a6762cb99a0..6d9993825a04 100644 --- a/lib/libc/i386/string/bcopy.S +++ b/lib/libc/i386/string/bcopy.S @@ -32,12 +32,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bcopy.S,v 1.1 1994/08/05 01:18:24 wollman Exp $ + * $Id: bcopy.S,v 1.2 1995/01/23 01:28:49 davidg Exp $ */ #if defined(LIBC_RCS) && !defined(lint) .text - .asciz "$Id: bcopy.S,v 1.1 1994/08/05 01:18:24 wollman Exp $" + .asciz "$Id: bcopy.S,v 1.2 1995/01/23 01:28:49 davidg Exp $" #endif /* LIBC_RCS and not lint */ #include "DEFS.h" @@ -53,8 +53,10 @@ ENTRY(bcopy) movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f cld /* nope, copy forwards. */ shrl $2,%ecx /* copy by words */ rep @@ -69,10 +71,10 @@ ENTRY(bcopy) 1: addl %ecx,%edi /* copy backwards. */ addl %ecx,%esi - std - andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + andl $3,%ecx /* any fractional bytes? */ + std rep movsb movl 20(%esp),%ecx /* copy remainder by words */ diff --git a/lib/libc/i386/string/memmove.S b/lib/libc/i386/string/memmove.S index 1c74561d5e2d..497af4fceacc 100644 --- a/lib/libc/i386/string/memmove.S +++ b/lib/libc/i386/string/memmove.S @@ -32,12 +32,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: memmove.S,v 1.1 1994/08/05 01:18:29 wollman Exp $ + * $Id: memmove.S,v 1.2 1995/01/23 01:29:02 davidg Exp $ */ #if defined(LIBC_RCS) && !defined(lint) .text - .asciz "$Id: memmove.S,v 1.1 1994/08/05 01:18:29 wollman Exp $" + .asciz "$Id: memmove.S,v 1.2 1995/01/23 01:29:02 davidg Exp $" #endif /* LIBC_RCS and not lint */ #include "DEFS.h" @@ -54,8 +54,10 @@ ENTRY(memmove) movl 12(%esp),%edi movl 16(%esp),%esi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax + jb 1f cld /* nope, copy forwards. */ shrl $2,%ecx /* copy by words */ rep @@ -71,10 +73,10 @@ ENTRY(memmove) 1: addl %ecx,%edi /* copy backwards. */ addl %ecx,%esi - std - andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + andl $3,%ecx /* any fractional bytes? */ + std rep movsb movl 20(%esp),%ecx /* copy remainder by words */ |
