From d197898a759eb49746491b2df74947775963f324 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sun, 1 Jun 2003 17:10:42 +0000 Subject: [PATCH] - Fixed a bug in the section which makes the destination pointer dword aligned. svn path=/trunk/; revision=4812 --- reactos/lib/string/i386/memcpy.s | 23 +++++++++++------------ reactos/lib/string/i386/memset.s | 31 ++++++++++++------------------- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/reactos/lib/string/i386/memcpy.s b/reactos/lib/string/i386/memcpy.s index c12681a1c48..ffdc2954ba9 100644 --- a/reactos/lib/string/i386/memcpy.s +++ b/reactos/lib/string/i386/memcpy.s @@ -1,5 +1,5 @@ /* - * $Id: memcpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ + * $Id: memcpy.s,v 1.2 2003/06/01 17:10:42 hbirr Exp $ */ /* @@ -17,23 +17,22 @@ _memcpy: mov 0xc(%ebp),%esi mov 0x10(%ebp),%ecx cld - cmp $4,%ecx + cmp $16,%ecx jb .L1 + mov %ecx,%edx test $3,%edi je .L2 /* - * Should we make the source or the destination dword aligned? + * Make the destination dword aligned */ - mov %ecx,%edx - mov %edi,%ecx - and $3,%ecx - sub %ecx,%edx - rep movsb - mov %edx,%ecx + mov %edi,%ecx + and $3,%ecx + sub $5,%ecx + not %ecx + sub %ecx,%edx + rep movsb + mov %edx,%ecx .L2: - cmp $4,%ecx - jb .L1 - mov %ecx,%edx shr $2,%ecx rep movsl mov %edx,%ecx diff --git a/reactos/lib/string/i386/memset.s b/reactos/lib/string/i386/memset.s index 4ae95383ec9..fc97b1a613e 100644 --- a/reactos/lib/string/i386/memset.s +++ b/reactos/lib/string/i386/memset.s @@ -1,5 +1,5 @@ /* - * $Id: memset.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ + * $Id: memset.s,v 1.2 2003/06/01 17:10:42 hbirr Exp $ */ /* @@ -9,33 +9,28 @@ .globl _memset _memset: -; push %ebp -; mov %esp,%ebp + push %ebp + mov %esp,%ebp push %edi - push %edx -; mov 0x8(%ebp),%edi -; movzb 0xc(%ebp),%eax -; mov 0x10(%ebp),%ecx - mov 0x10(%esp),%edi - movzb 0x14(%esp),%eax - mov 0x18(%esp),%ecx + mov 0x8(%ebp),%edi + movzb 0xc(%ebp),%eax + mov 0x10(%ebp),%ecx cld - cmp $4,%ecx + cmp $16,%ecx jb .L1 mov $0x01010101,%edx mul %edx + mov %ecx,%edx test $3,%edi je .L2 - mov %ecx,%edx mov %edi,%ecx and $3,%ecx + sub $5,%ecx + not %ecx sub %ecx,%edx rep stosb mov %edx,%ecx .L2: - cmp $4,%ecx - jb .L1 - mov %ecx,%edx shr $2,%ecx rep stosl mov %edx,%ecx @@ -45,10 +40,8 @@ _memset: je .L3 rep stosb .L3: - pop %edx pop %edi -; mov 0x8(%ebp),%eax - mov 0x8(%esp),%eax -; leave + mov 0x8(%ebp),%eax + leave ret