Rev 490 | Rev 520 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 490 | Rev 519 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | $Revision: 490 $ |
1 | $Revision: 519 $ |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
3 | ;; ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
Line 1055... | Line 1055... | ||
1055 | wrmsr |
1055 | wrmsr |
1056 | ret |
1056 | ret |
1057 | endp |
1057 | endp |
Line 1058... | Line -... | ||
1058 | - | ||
1059 | - | ||
1060 | align 4 |
- | |
1061 | proc strncmp stdcall, str1:dword, str2:dword, count:dword |
- | |
1062 | - | ||
1063 | mov ecx,[count] |
- | |
1064 | jecxz .end |
- | |
1065 | - | ||
1066 | mov ebx,ecx |
- | |
1067 | - | ||
1068 | mov edi,[str1] |
- | |
1069 | mov esi,edi |
- | |
1070 | xor eax,eax |
- | |
1071 | repne scasb |
- | |
1072 | neg ecx ; cx = count - strlen |
- | |
1073 | add ecx,ebx ; strlen + count - strlen |
- | |
1074 | - | ||
1075 | .okay: |
- | |
1076 | mov edi,esi |
- | |
1077 | mov esi,[str2] |
- | |
1078 | repe cmpsb |
- | |
1079 | mov al,[esi-1] |
- | |
1080 | xor ecx,ecx |
- | |
1081 | - | ||
1082 | cmp al,[edi-1] |
- | |
1083 | ja .str2_big |
- | |
1084 | je .end |
- | |
1085 | - | ||
1086 | .str1_big: |
- | |
1087 | sub ecx,2 |
- | |
1088 | - | ||
1089 | .str2_big: |
- | |
1090 | not ecx |
- | |
1091 | .end: |
- | |
1092 | mov eax,ecx |
- | |
Line 1093... | Line 1058... | ||
1093 | ret |
1058 | |
1094 | endp |
1059 | |
1095 | 1060 | ||
1096 | align 4 |
1061 | align 4 |
Line 1118... | Line 1083... | ||
1118 | pop edx |
1083 | pop edx |
1119 | pop ecx |
1084 | pop ecx |
1120 | ret |
1085 | ret |
1121 | endp |
1086 | endp |
Line 1122... | Line -... | ||
1122 | - | ||
1123 | align 4 |
- | |
1124 | k_strrchr: |
- | |
1125 | push eax |
- | |
1126 | xor eax,eax |
- | |
1127 | or ecx,-1 |
- | |
1128 | repne scasb |
- | |
1129 | add ecx,1 |
- | |
1130 | neg ecx |
- | |
1131 | sub edi,1 |
- | |
1132 | pop eax |
- | |
1133 | std |
- | |
1134 | repne scasb |
- | |
1135 | cld |
- | |
1136 | add edi,1 |
- | |
1137 | - | ||
1138 | cmp [edi],al |
- | |
1139 | jne @F |
- | |
1140 | mov eax,edi |
- | |
1141 | ret |
- | |
1142 | @@: |
- | |
1143 | xor eax,eax |
- | |
1144 | ret |
- | |
1145 | - | ||
1146 | align 4 |
- | |
1147 | proc k_strncpy stdcall, dest:dword, src:dword, maxlen:dword |
- | |
1148 | mov eax, [dest] |
- | |
1149 | mov esi, [src] |
- | |
1150 | mov ecx, [maxlen] |
- | |
1151 | test eax, eax |
- | |
1152 | jz .L9 |
- | |
1153 | test esi, esi |
- | |
1154 | jz .L9 |
- | |
1155 | test ecx, ecx |
- | |
1156 | jz .L9 |
- | |
1157 | - | ||
1158 | sub esi, eax |
- | |
1159 | jmp .L1 |
- | |
1160 | - | ||
1161 | align 4 |
- | |
1162 | .L2: |
- | |
1163 | mov edx, [esi+eax] |
- | |
1164 | mov [eax], dl |
- | |
1165 | test dl, dl |
- | |
1166 | jz .L7 |
- | |
1167 | - | ||
1168 | mov [eax+1], dh |
- | |
1169 | test dh, dh |
- | |
1170 | jz .L6 |
- | |
1171 | - | ||
1172 | shr edx, 16 |
- | |
1173 | mov [eax+2],dl |
- | |
1174 | test dl, dl |
- | |
1175 | jz .L5 |
- | |
1176 | - | ||
1177 | mov [eax+3], dh |
- | |
1178 | test dh, dh |
- | |
1179 | jz .L4 |
- | |
1180 | add eax, 4 |
- | |
1181 | .L1: |
- | |
1182 | sub ecx, 4 |
- | |
1183 | jae .L2 |
- | |
1184 | - | ||
1185 | add ecx, 4 |
- | |
1186 | jz .L9 |
- | |
1187 | - | ||
1188 | mov dl, [eax+esi] |
- | |
1189 | mov [eax], dl |
- | |
1190 | test dl, dl |
- | |
1191 | jz .L3 |
- | |
1192 | - | ||
1193 | inc eax |
- | |
1194 | dec ecx |
- | |
1195 | jz .L9 |
- | |
1196 | - | ||
1197 | mov dl, [eax+esi] |
- | |
1198 | mov [eax], dl |
- | |
1199 | test dl, dl |
- | |
1200 | jz .L3 |
- | |
1201 | - | ||
1202 | inc eax |
- | |
1203 | dec ecx |
- | |
1204 | jz .L9 |
- | |
1205 | - | ||
1206 | mov dl, [eax+esi] |
- | |
1207 | mov [eax], dl |
- | |
1208 | test dl, dl |
- | |
1209 | jz .L3 |
- | |
1210 | - | ||
1211 | inc eax |
- | |
1212 | jmp .L9 |
- | |
1213 | - | ||
1214 | .L4: dec ecx |
- | |
1215 | inc eax |
- | |
1216 | - | ||
1217 | .L5: dec ecx |
- | |
1218 | inc eax |
- | |
1219 | - | ||
1220 | .L6: dec ecx |
- | |
1221 | inc eax |
- | |
1222 | .L7: |
- | |
1223 | add ecx,3 |
- | |
1224 | jz .L9 |
- | |
1225 | .L8: |
- | |
1226 | mov byte [ecx+eax], 0 |
- | |
1227 | .L3: |
- | |
1228 | dec ecx |
- | |
1229 | jnz .L8 |
- | |
1230 | .L9: |
- | |
1231 | ret |
- | |
1232 | endp |
- | |
1233 | - | ||
1234 | if 0 |
- | |
1235 | - | ||
1236 | magic equ 0xfefefeff |
- | |
1237 | - | ||
1238 | k_strlen: |
- | |
1239 | mov eax,[esp+4] |
- | |
1240 | mov edx, 3 |
- | |
1241 | - | ||
1242 | and edx, eax |
- | |
1243 | jz .L1 |
- | |
1244 | jp .L0 |
- | |
1245 | - | ||
1246 | cmp dh, byte [eax] |
- | |
1247 | je .L2 |
- | |
1248 | - | ||
1249 | inc eax |
- | |
1250 | cmp dh, byte [eax] |
- | |
1251 | - | ||
1252 | je .L2 |
- | |
1253 | - | ||
1254 | inc eax |
- | |
1255 | xor edx, 2 |
- | |
1256 | - | ||
1257 | jz .L1 |
- | |
1258 | .L0: |
- | |
1259 | cmp dh, [eax] |
- | |
1260 | je .L2 |
- | |
1261 | - | ||
1262 | inc eax |
- | |
1263 | xor edx, edx |
- | |
1264 | - | ||
1265 | .L1: |
- | |
1266 | mov ecx, [eax] |
- | |
1267 | add eax, 4 |
- | |
1268 | - | ||
1269 | sub edx, ecx |
- | |
1270 | add ecx, magic |
- | |
1271 | - | ||
1272 | dec edx |
- | |
1273 | jnc .L3 |
- | |
1274 | - | ||
1275 | xor edx, ecx |
- | |
1276 | and edx, not magic |
- | |
1277 | jne .L3 |
- | |
1278 | - | ||
1279 | mov ecx, [eax] |
- | |
1280 | add eax, 4 |
- | |
1281 | - | ||
1282 | sub edx, ecx |
- | |
1283 | add ecx, magic |
- | |
1284 | dec edx |
- | |
1285 | jnc .L3 |
- | |
1286 | - | ||
1287 | xor edx, ecx |
- | |
1288 | and edx, not magic |
- | |
1289 | jne .L3 |
- | |
1290 | - | ||
1291 | mov ecx, [eax] |
- | |
1292 | add eax, 4 |
- | |
1293 | - | ||
1294 | sub edx, ecx |
- | |
1295 | add ecx, magic |
- | |
1296 | - | ||
1297 | dec edx |
- | |
1298 | jnc .L3 |
- | |
1299 | - | ||
1300 | xor edx, ecx |
- | |
1301 | - | ||
1302 | and edx, not magic |
- | |
1303 | jne .L3 |
- | |
1304 | - | ||
1305 | mov ecx, [eax] |
- | |
1306 | add eax, 4 |
- | |
1307 | - | ||
1308 | sub edx, ecx |
- | |
1309 | add ecx, magic |
- | |
1310 | - | ||
1311 | dec edx |
- | |
1312 | jnc .L3 |
- | |
1313 | - | ||
1314 | xor edx, ecx |
- | |
1315 | - | ||
1316 | and edx, not magic |
- | |
1317 | je .L1 |
- | |
1318 | - | ||
1319 | .L3: sub eax ,4 |
- | |
1320 | sub ecx, magic |
- | |
1321 | - | ||
1322 | cmp cl, 0 |
- | |
1323 | jz .L2 |
- | |
1324 | - | ||
1325 | inc eax |
- | |
1326 | test ch, ch |
- | |
1327 | jz .L2 |
- | |
1328 | - | ||
1329 | shr ecx, 16 |
- | |
1330 | inc eax |
- | |
1331 | - | ||
1332 | cmp cl,0 |
- | |
1333 | jz .L2 |
- | |
1334 | - | ||
1335 | inc eax |
- | |
1336 | - | ||
1337 | .L2: |
- | |
1338 | sub eax, [esp+4] |
- | |
1339 | ret |
- | |
1340 | - | ||
Line 1341... | Line 1087... | ||
1341 | end if |
1087 | |
1342 | 1088 | ||
1343 | if 0 |
1089 | if 0 |
1344 | push eax |
1090 | push eax |