projects
/
reactos.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
migrate substitution keywords to SVN
[reactos.git]
/
reactos
/
lib
/
string
/
i386
/
memmove.s
1
/*
2
* $Id$
3
*/
4
5
/*
6
* void *memmove (void *to, const void *from, size_t count)
7
*/
8
9
.globl _memmove
10
11
_memmove:
12
push %ebp
13
mov %esp,%ebp
14
15
push %esi
16
push %edi
17
18
mov 8(%ebp),%edi
19
mov 12(%ebp),%esi
20
mov 16(%ebp),%ecx
21
22
cmp %esi,%edi
23
jbe .CopyUp
24
mov %ecx,%eax
25
add %esi,%eax
26
cmp %eax,%edi
27
jb .CopyDown
28
29
.CopyUp:
30
cld
31
32
cmp $16,%ecx
33
jb .L1
34
mov %ecx,%edx
35
test $3,%edi
36
je .L2
37
/*
38
* Make the destination dword aligned
39
*/
40
mov %edi,%ecx
41
and $3,%ecx
42
sub $5,%ecx
43
not %ecx
44
sub %ecx,%edx
45
rep movsb
46
mov %edx,%ecx
47
.L2:
48
shr $2,%ecx
49
rep movsl
50
mov %edx,%ecx
51
and $3,%ecx
52
.L1:
53
test %ecx,%ecx
54
je .L3
55
rep movsb
56
.L3:
57
mov 16(%ebp),%eax
58
pop %edi
59
pop %esi
60
leave
61
ret
62
63
.CopyDown:
64
std
65
66
add %ecx,%edi
67
add %ecx,%esi
68
69
cmp $16,%ecx
70
jb .L4
71
mov %ecx,%edx
72
test $3,%edi
73
je .L5
74
75
/*
76
* Make the destination dword aligned
77
*/
78
mov %edi,%ecx
79
and $3,%ecx
80
sub %ecx,%edx
81
dec %esi
82
dec %edi
83
rep movsb
84
mov %edx,%ecx
85
86
sub $3,%esi
87
sub $3,%edi
88
.L6:
89
shr $2,%ecx
90
rep movsl
91
mov %edx,%ecx
92
and $3,%ecx
93
je .L7
94
add $3,%esi
95
add $3,%edi
96
.L8:
97
rep movsb
98
.L7:
99
cld
100
mov 8(%ebp),%eax
101
pop %edi
102
pop %esi
103
leave
104
ret
105
.L5:
106
sub $4,%edi
107
sub $4,%esi
108
jmp .L6
109
110
.L4:
111
test %ecx,%ecx
112
je .L7
113
dec %esi
114
dec %edi
115
jmp .L8
116