- 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 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

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
_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