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