- Fixed a bug in the section which makes the destination pointer dword aligned.

svn path=/trunk/; revision=4812
This commit is contained in:
Hartmut Birr 2003-06-01 17:10:42 +00:00
parent cdeedf3bb4
commit d197898a75
2 changed files with 23 additions and 31 deletions

View file

@ -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 0xc(%ebp),%esi
mov 0x10(%ebp),%ecx mov 0x10(%ebp),%ecx
cld cld
cmp $4,%ecx cmp $16,%ecx
jb .L1 jb .L1
mov %ecx,%edx
test $3,%edi test $3,%edi
je .L2 je .L2
/* /*
* Should we make the source or the destination dword aligned? * Make the destination dword aligned
*/ */
mov %ecx,%edx mov %edi,%ecx
mov %edi,%ecx and $3,%ecx
and $3,%ecx sub $5,%ecx
sub %ecx,%edx not %ecx
rep movsb sub %ecx,%edx
mov %edx,%ecx rep movsb
mov %edx,%ecx
.L2: .L2:
cmp $4,%ecx
jb .L1
mov %ecx,%edx
shr $2,%ecx shr $2,%ecx
rep movsl rep movsl
mov %edx,%ecx mov %edx,%ecx

View file

@ -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 .globl _memset
_memset: _memset:
; push %ebp push %ebp
; mov %esp,%ebp mov %esp,%ebp
push %edi push %edi
push %edx mov 0x8(%ebp),%edi
; mov 0x8(%ebp),%edi movzb 0xc(%ebp),%eax
; movzb 0xc(%ebp),%eax mov 0x10(%ebp),%ecx
; mov 0x10(%ebp),%ecx
mov 0x10(%esp),%edi
movzb 0x14(%esp),%eax
mov 0x18(%esp),%ecx
cld cld
cmp $4,%ecx cmp $16,%ecx
jb .L1 jb .L1
mov $0x01010101,%edx mov $0x01010101,%edx
mul %edx mul %edx
mov %ecx,%edx
test $3,%edi test $3,%edi
je .L2 je .L2
mov %ecx,%edx
mov %edi,%ecx mov %edi,%ecx
and $3,%ecx and $3,%ecx
sub $5,%ecx
not %ecx
sub %ecx,%edx sub %ecx,%edx
rep stosb rep stosb
mov %edx,%ecx mov %edx,%ecx
.L2: .L2:
cmp $4,%ecx
jb .L1
mov %ecx,%edx
shr $2,%ecx shr $2,%ecx
rep stosl rep stosl
mov %edx,%ecx mov %edx,%ecx
@ -45,10 +40,8 @@ _memset:
je .L3 je .L3
rep stosb rep stosb
.L3: .L3:
pop %edx
pop %edi pop %edi
; mov 0x8(%ebp),%eax mov 0x8(%ebp),%eax
mov 0x8(%esp),%eax leave
; leave
ret ret