repo.or.cz
/
neatlibc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
stdlib: fix the return value of exit()
[neatlibc.git]
/
string.s
blob
2287dbc910ee276ff7992968bb3b9db86fde3dde
1
format ELF
2
3
public memcpy
4
memcpy
:
5
push esi
6
push edi
7
mov edi
, [
esp+
12
]
8
mov esi
, [
esp+
16
]
9
mov ecx
, [
esp+
20
]
10
mov eax
,
edi
11
cld
12
rep movsb
13
pop edi
14
pop esi
15
ret
16
17
public memmove
18
memmove
:
19
push esi
20
push edi
21
mov edi
, [
esp+
12
]
22
mov esi
, [
esp+
16
]
23
mov ecx
, [
esp+
20
]
24
cmp
edi
,
esi
25
jng
.usual
26
mov eax
,
esi
27
add
eax
,
ecx
28
cmp
edi
,
eax
29
jg
.usual
30
31
mov eax
,
edi
32
std
33
add
esi
,
ecx
34
add
edi
,
ecx
35
dec
esi
36
dec
edi
37
rep movsb
38
jmp
.ret
39
.usual:
40
mov eax
,
edi
41
cld
42
rep movsb
43
.ret:
44
pop edi
45
pop esi
46
ret
47
48
public memset
49
memset
:
50
push edi
51
mov edi
, [
esp+
8
]
52
mov eax
, [
esp+
12
]
53
mov ecx
, [
esp+
16
]
54
mov edx
,
edi
55
cld
56
rep stosb
57
pop edi
58
mov eax
,
edx
59
ret
60
61
public memchr
62
memchr
:
63
mov eax
, [
esp+
8
]
64
mov ecx
, [
esp+
12
]
65
push edi
66
mov edi
, [
esp+
8
]
67
cld
68
repnz scasb
69
jne
.failed
70
mov eax
,
edi
71
dec
eax
72
jmp
.ret
73
.failed:
74
xor
eax
,
eax
75
.ret:
76
pop edi
77
ret
78
79
public memcmp
80
memcmp
:
81
push esi
82
push edi
83
xor
eax
,
eax
84
mov esi
, [
esp+
12
]
85
mov edi
, [
esp+
16
]
86
mov ecx
, [
esp+
20
]
87
jecxz
.ret
88
89
cld
90
rep cmpsb
91
jz
.ret
92
sbb eax
,
eax
93
or
eax
,
1
94
.ret:
95
pop edi
96
pop esi
97
ret
98
99
public strlen
100
strlen
:
101
push edi
102
mov edi
, [
esp+
8
]
103
xor
eax
,
eax
104
mov ecx
, -
1
105
cld
106
repnz scasb
107
mov eax
,
ecx
108
not
eax
109
dec
eax
110
pop edi
111
ret
112
113
public strchr
114
strchr
:
115
mov ecx
, [
esp+
4
]
116
mov edx
, [
esp+
8
]
117
.loop:
118
mov al
, [
ecx
]
119
cmp
al
,
dl
120
jz
.done
121
inc ecx
122
test al
,
al
123
jnz
.loop
124
xor
ecx
,
ecx
125
.done:
126
mov eax
,
ecx
127
ret
128
129
public strcmp
130
strcmp
:
131
mov ecx
, [
esp+
4
]
132
mov edx
, [
esp+
8
]
133
xor
eax
,
eax
134
.loop:
135
mov al
, [
ecx
]
136
cmp
al
, [
edx
]
137
jnz
.ret
138
inc edx
139
inc ecx
140
test al
,
al
141
jnz
.loop
142
ret
143
.ret:
144
movzx ecx
,
byte
[
edx
]
145
sub
eax
,
ecx
146
ret
147
148
public strcpy
149
strcpy
:
150
push edi
151
push esi
152
mov edx
, [
esp+
12
]
153
mov esi
, [
esp+
16
]
154
mov edi
,
edx
155
cld
156
.loop:
157
lodsb
158
stosb
159
or
al
,
al
160
jnz
.loop
161
pop esi
162
pop edi
163
mov eax
,
edx
164
ret