inffas32.asm 16 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. ;/* inffas32.asm is a hand tuned assembler version of inffast.c -- fast decoding
  2. ; *
  3. ; * inffas32.asm is derivated from inffas86.c, with translation of assembly code
  4. ; *
  5. ; * Copyright (C) 1995-2003 Mark Adler
  6. ; * For conditions of distribution and use, see copyright notice in zlib.h
  7. ; *
  8. ; * Copyright (C) 2003 Chris Anderson <christop@charm.net>
  9. ; * Please use the copyright conditions above.
  10. ; *
  11. ; * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
  12. ; * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
  13. ; * the moment. I have successfully compiled and tested this code with gcc2.96,
  14. ; * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
  15. ; * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
  16. ; * enabled. I will attempt to merge the MMX code into this version. Newer
  17. ; * versions of this and inffast.S can be found at
  18. ; * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
  19. ; *
  20. ; * 2005 : modification by Gilles Vollant
  21. ; */
  22. ; For Visual C++ 4.x and higher and ML 6.x and higher
  23. ; ml.exe is in directory \MASM611C of Win95 DDK
  24. ; ml.exe is also distributed in http://www.masm32.com/masmdl.htm
  25. ; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/
  26. ;
  27. ;
  28. ; compile with command line option
  29. ; ml /coff /Zi /c /Flinffas32.lst inffas32.asm
  30. ; if you define NO_GZIP (see inflate.h), compile with
  31. ; ml /coff /Zi /c /Flinffas32.lst /DNO_GUNZIP inffas32.asm
  32. ; zlib122sup is 0 fort zlib 1.2.2.1 and lower
  33. ; zlib122sup is 8 fort zlib 1.2.2.2 and more (with addition of dmax and head
  34. ; in inflate_state in inflate.h)
  35. zlib1222sup equ 8
  36. IFDEF GUNZIP
  37. INFLATE_MODE_TYPE equ 11
  38. INFLATE_MODE_BAD equ 26
  39. ELSE
  40. IFNDEF NO_GUNZIP
  41. INFLATE_MODE_TYPE equ 11
  42. INFLATE_MODE_BAD equ 26
  43. ELSE
  44. INFLATE_MODE_TYPE equ 3
  45. INFLATE_MODE_BAD equ 17
  46. ENDIF
  47. ENDIF
  48. ; 75 "inffast.S"
  49. ;FILE "inffast.S"
  50. ;;;GLOBAL _inflate_fast
  51. ;;;SECTION .text
  52. .586p
  53. .mmx
  54. name inflate_fast_x86
  55. .MODEL FLAT
  56. _DATA segment
  57. inflate_fast_use_mmx:
  58. dd 1
  59. _TEXT segment
  60. ALIGN 4
  61. db 'Fast decoding Code from Chris Anderson'
  62. db 0
  63. ALIGN 4
  64. invalid_literal_length_code_msg:
  65. db 'invalid literal/length code'
  66. db 0
  67. ALIGN 4
  68. invalid_distance_code_msg:
  69. db 'invalid distance code'
  70. db 0
  71. ALIGN 4
  72. invalid_distance_too_far_msg:
  73. db 'invalid distance too far back'
  74. db 0
  75. ALIGN 4
  76. inflate_fast_mask:
  77. dd 0
  78. dd 1
  79. dd 3
  80. dd 7
  81. dd 15
  82. dd 31
  83. dd 63
  84. dd 127
  85. dd 255
  86. dd 511
  87. dd 1023
  88. dd 2047
  89. dd 4095
  90. dd 8191
  91. dd 16383
  92. dd 32767
  93. dd 65535
  94. dd 131071
  95. dd 262143
  96. dd 524287
  97. dd 1048575
  98. dd 2097151
  99. dd 4194303
  100. dd 8388607
  101. dd 16777215
  102. dd 33554431
  103. dd 67108863
  104. dd 134217727
  105. dd 268435455
  106. dd 536870911
  107. dd 1073741823
  108. dd 2147483647
  109. dd 4294967295
  110. mode_state equ 0 ;/* state->mode */
  111. wsize_state equ (32+zlib1222sup) ;/* state->wsize */
  112. write_state equ (36+4+zlib1222sup) ;/* state->write */
  113. window_state equ (40+4+zlib1222sup) ;/* state->window */
  114. hold_state equ (44+4+zlib1222sup) ;/* state->hold */
  115. bits_state equ (48+4+zlib1222sup) ;/* state->bits */
  116. lencode_state equ (64+4+zlib1222sup) ;/* state->lencode */
  117. distcode_state equ (68+4+zlib1222sup) ;/* state->distcode */
  118. lenbits_state equ (72+4+zlib1222sup) ;/* state->lenbits */
  119. distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */
  120. ;;SECTION .text
  121. ; 205 "inffast.S"
  122. ;GLOBAL inflate_fast_use_mmx
  123. ;SECTION .data
  124. ; GLOBAL inflate_fast_use_mmx:object
  125. ;.size inflate_fast_use_mmx, 4
  126. ; 226 "inffast.S"
  127. ;SECTION .text
  128. ALIGN 4
  129. _inflate_fast proc near
  130. .FPO (16, 4, 0, 0, 1, 0)
  131. push edi
  132. push esi
  133. push ebp
  134. push ebx
  135. pushfd
  136. sub esp,64
  137. cld
  138. mov esi, [esp+88]
  139. mov edi, [esi+28]
  140. mov edx, [esi+4]
  141. mov eax, [esi+0]
  142. add edx,eax
  143. sub edx,11
  144. mov [esp+44],eax
  145. mov [esp+20],edx
  146. mov ebp, [esp+92]
  147. mov ecx, [esi+16]
  148. mov ebx, [esi+12]
  149. sub ebp,ecx
  150. neg ebp
  151. add ebp,ebx
  152. sub ecx,257
  153. add ecx,ebx
  154. mov [esp+60],ebx
  155. mov [esp+40],ebp
  156. mov [esp+16],ecx
  157. ; 285 "inffast.S"
  158. mov eax, [edi+lencode_state]
  159. mov ecx, [edi+distcode_state]
  160. mov [esp+8],eax
  161. mov [esp+12],ecx
  162. mov eax,1
  163. mov ecx, [edi+lenbits_state]
  164. shl eax,cl
  165. dec eax
  166. mov [esp+0],eax
  167. mov eax,1
  168. mov ecx, [edi+distbits_state]
  169. shl eax,cl
  170. dec eax
  171. mov [esp+4],eax
  172. mov eax, [edi+wsize_state]
  173. mov ecx, [edi+write_state]
  174. mov edx, [edi+window_state]
  175. mov [esp+52],eax
  176. mov [esp+48],ecx
  177. mov [esp+56],edx
  178. mov ebp, [edi+hold_state]
  179. mov ebx, [edi+bits_state]
  180. ; 321 "inffast.S"
  181. mov esi, [esp+44]
  182. mov ecx, [esp+20]
  183. cmp ecx,esi
  184. ja L_align_long
  185. add ecx,11
  186. sub ecx,esi
  187. mov eax,12
  188. sub eax,ecx
  189. lea edi, [esp+28]
  190. rep movsb
  191. mov ecx,eax
  192. xor eax,eax
  193. rep stosb
  194. lea esi, [esp+28]
  195. mov [esp+20],esi
  196. jmp L_is_aligned
  197. L_align_long:
  198. test esi,3
  199. jz L_is_aligned
  200. xor eax,eax
  201. mov al, [esi]
  202. inc esi
  203. mov ecx,ebx
  204. add ebx,8
  205. shl eax,cl
  206. or ebp,eax
  207. jmp L_align_long
  208. L_is_aligned:
  209. mov edi, [esp+60]
  210. ; 366 "inffast.S"
  211. L_check_mmx:
  212. cmp dword ptr [inflate_fast_use_mmx],2
  213. je L_init_mmx
  214. ja L_do_loop
  215. push eax
  216. push ebx
  217. push ecx
  218. push edx
  219. pushfd
  220. mov eax, [esp]
  221. xor dword ptr [esp],0200000h
  222. popfd
  223. pushfd
  224. pop edx
  225. xor edx,eax
  226. jz L_dont_use_mmx
  227. xor eax,eax
  228. cpuid
  229. cmp ebx,0756e6547h
  230. jne L_dont_use_mmx
  231. cmp ecx,06c65746eh
  232. jne L_dont_use_mmx
  233. cmp edx,049656e69h
  234. jne L_dont_use_mmx
  235. mov eax,1
  236. cpuid
  237. shr eax,8
  238. and eax,15
  239. cmp eax,6
  240. jne L_dont_use_mmx
  241. test edx,0800000h
  242. jnz L_use_mmx
  243. jmp L_dont_use_mmx
  244. L_use_mmx:
  245. mov dword ptr [inflate_fast_use_mmx],2
  246. jmp L_check_mmx_pop
  247. L_dont_use_mmx:
  248. mov dword ptr [inflate_fast_use_mmx],3
  249. L_check_mmx_pop:
  250. pop edx
  251. pop ecx
  252. pop ebx
  253. pop eax
  254. jmp L_check_mmx
  255. ; 426 "inffast.S"
  256. ALIGN 4
  257. L_do_loop:
  258. ; 437 "inffast.S"
  259. cmp bl,15
  260. ja L_get_length_code
  261. xor eax,eax
  262. lodsw
  263. mov cl,bl
  264. add bl,16
  265. shl eax,cl
  266. or ebp,eax
  267. L_get_length_code:
  268. mov edx, [esp+0]
  269. mov ecx, [esp+8]
  270. and edx,ebp
  271. mov eax, [ecx+edx*4]
  272. L_dolen:
  273. mov cl,ah
  274. sub bl,ah
  275. shr ebp,cl
  276. test al,al
  277. jnz L_test_for_length_base
  278. shr eax,16
  279. stosb
  280. L_while_test:
  281. cmp [esp+16],edi
  282. jbe L_break_loop
  283. cmp [esp+20],esi
  284. ja L_do_loop
  285. jmp L_break_loop
  286. L_test_for_length_base:
  287. ; 502 "inffast.S"
  288. mov edx,eax
  289. shr edx,16
  290. mov cl,al
  291. test al,16
  292. jz L_test_for_second_level_length
  293. and cl,15
  294. jz L_save_len
  295. cmp bl,cl
  296. jae L_add_bits_to_len
  297. mov ch,cl
  298. xor eax,eax
  299. lodsw
  300. mov cl,bl
  301. add bl,16
  302. shl eax,cl
  303. or ebp,eax
  304. mov cl,ch
  305. L_add_bits_to_len:
  306. mov eax,1
  307. shl eax,cl
  308. dec eax
  309. sub bl,cl
  310. and eax,ebp
  311. shr ebp,cl
  312. add edx,eax
  313. L_save_len:
  314. mov [esp+24],edx
  315. L_decode_distance:
  316. ; 549 "inffast.S"
  317. cmp bl,15
  318. ja L_get_distance_code
  319. xor eax,eax
  320. lodsw
  321. mov cl,bl
  322. add bl,16
  323. shl eax,cl
  324. or ebp,eax
  325. L_get_distance_code:
  326. mov edx, [esp+4]
  327. mov ecx, [esp+12]
  328. and edx,ebp
  329. mov eax, [ecx+edx*4]
  330. L_dodist:
  331. mov edx,eax
  332. shr edx,16
  333. mov cl,ah
  334. sub bl,ah
  335. shr ebp,cl
  336. ; 584 "inffast.S"
  337. mov cl,al
  338. test al,16
  339. jz L_test_for_second_level_dist
  340. and cl,15
  341. jz L_check_dist_one
  342. cmp bl,cl
  343. jae L_add_bits_to_dist
  344. mov ch,cl
  345. xor eax,eax
  346. lodsw
  347. mov cl,bl
  348. add bl,16
  349. shl eax,cl
  350. or ebp,eax
  351. mov cl,ch
  352. L_add_bits_to_dist:
  353. mov eax,1
  354. shl eax,cl
  355. dec eax
  356. sub bl,cl
  357. and eax,ebp
  358. shr ebp,cl
  359. add edx,eax
  360. jmp L_check_window
  361. L_check_window:
  362. ; 625 "inffast.S"
  363. mov [esp+44],esi
  364. mov eax,edi
  365. sub eax, [esp+40]
  366. cmp eax,edx
  367. jb L_clip_window
  368. mov ecx, [esp+24]
  369. mov esi,edi
  370. sub esi,edx
  371. sub ecx,3
  372. mov al, [esi]
  373. mov [edi],al
  374. mov al, [esi+1]
  375. mov dl, [esi+2]
  376. add esi,3
  377. mov [edi+1],al
  378. mov [edi+2],dl
  379. add edi,3
  380. rep movsb
  381. mov esi, [esp+44]
  382. jmp L_while_test
  383. ALIGN 4
  384. L_check_dist_one:
  385. cmp edx,1
  386. jne L_check_window
  387. cmp [esp+40],edi
  388. je L_check_window
  389. dec edi
  390. mov ecx, [esp+24]
  391. mov al, [edi]
  392. sub ecx,3
  393. mov [edi+1],al
  394. mov [edi+2],al
  395. mov [edi+3],al
  396. add edi,4
  397. rep stosb
  398. jmp L_while_test
  399. ALIGN 4
  400. L_test_for_second_level_length:
  401. test al,64
  402. jnz L_test_for_end_of_block
  403. mov eax,1
  404. shl eax,cl
  405. dec eax
  406. and eax,ebp
  407. add eax,edx
  408. mov edx, [esp+8]
  409. mov eax, [edx+eax*4]
  410. jmp L_dolen
  411. ALIGN 4
  412. L_test_for_second_level_dist:
  413. test al,64
  414. jnz L_invalid_distance_code
  415. mov eax,1
  416. shl eax,cl
  417. dec eax
  418. and eax,ebp
  419. add eax,edx
  420. mov edx, [esp+12]
  421. mov eax, [edx+eax*4]
  422. jmp L_dodist
  423. ALIGN 4
  424. L_clip_window:
  425. ; 721 "inffast.S"
  426. mov ecx,eax
  427. mov eax, [esp+52]
  428. neg ecx
  429. mov esi, [esp+56]
  430. cmp eax,edx
  431. jb L_invalid_distance_too_far
  432. add ecx,edx
  433. cmp dword ptr [esp+48],0
  434. jne L_wrap_around_window
  435. sub eax,ecx
  436. add esi,eax
  437. ; 749 "inffast.S"
  438. mov eax, [esp+24]
  439. cmp eax,ecx
  440. jbe L_do_copy1
  441. sub eax,ecx
  442. rep movsb
  443. mov esi,edi
  444. sub esi,edx
  445. jmp L_do_copy1
  446. cmp eax,ecx
  447. jbe L_do_copy1
  448. sub eax,ecx
  449. rep movsb
  450. mov esi,edi
  451. sub esi,edx
  452. jmp L_do_copy1
  453. L_wrap_around_window:
  454. ; 793 "inffast.S"
  455. mov eax, [esp+48]
  456. cmp ecx,eax
  457. jbe L_contiguous_in_window
  458. add esi, [esp+52]
  459. add esi,eax
  460. sub esi,ecx
  461. sub ecx,eax
  462. mov eax, [esp+24]
  463. cmp eax,ecx
  464. jbe L_do_copy1
  465. sub eax,ecx
  466. rep movsb
  467. mov esi, [esp+56]
  468. mov ecx, [esp+48]
  469. cmp eax,ecx
  470. jbe L_do_copy1
  471. sub eax,ecx
  472. rep movsb
  473. mov esi,edi
  474. sub esi,edx
  475. jmp L_do_copy1
  476. L_contiguous_in_window:
  477. ; 836 "inffast.S"
  478. add esi,eax
  479. sub esi,ecx
  480. mov eax, [esp+24]
  481. cmp eax,ecx
  482. jbe L_do_copy1
  483. sub eax,ecx
  484. rep movsb
  485. mov esi,edi
  486. sub esi,edx
  487. L_do_copy1:
  488. ; 862 "inffast.S"
  489. mov ecx,eax
  490. rep movsb
  491. mov esi, [esp+44]
  492. jmp L_while_test
  493. ; 878 "inffast.S"
  494. ALIGN 4
  495. L_init_mmx:
  496. emms
  497. movd mm0,ebp
  498. mov ebp,ebx
  499. ; 896 "inffast.S"
  500. movd mm4,dword ptr [esp+0]
  501. movq mm3,mm4
  502. movd mm5,dword ptr [esp+4]
  503. movq mm2,mm5
  504. pxor mm1,mm1
  505. mov ebx, [esp+8]
  506. jmp L_do_loop_mmx
  507. ALIGN 4
  508. L_do_loop_mmx:
  509. psrlq mm0,mm1
  510. cmp ebp,32
  511. ja L_get_length_code_mmx
  512. movd mm6,ebp
  513. movd mm7,dword ptr [esi]
  514. add esi,4
  515. psllq mm7,mm6
  516. add ebp,32
  517. por mm0,mm7
  518. L_get_length_code_mmx:
  519. pand mm4,mm0
  520. movd eax,mm4
  521. movq mm4,mm3
  522. mov eax, [ebx+eax*4]
  523. L_dolen_mmx:
  524. movzx ecx,ah
  525. movd mm1,ecx
  526. sub ebp,ecx
  527. test al,al
  528. jnz L_test_for_length_base_mmx
  529. shr eax,16
  530. stosb
  531. L_while_test_mmx:
  532. cmp [esp+16],edi
  533. jbe L_break_loop
  534. cmp [esp+20],esi
  535. ja L_do_loop_mmx
  536. jmp L_break_loop
  537. L_test_for_length_base_mmx:
  538. mov edx,eax
  539. shr edx,16
  540. test al,16
  541. jz L_test_for_second_level_length_mmx
  542. and eax,15
  543. jz L_decode_distance_mmx
  544. psrlq mm0,mm1
  545. movd mm1,eax
  546. movd ecx,mm0
  547. sub ebp,eax
  548. and ecx, [inflate_fast_mask+eax*4]
  549. add edx,ecx
  550. L_decode_distance_mmx:
  551. psrlq mm0,mm1
  552. cmp ebp,32
  553. ja L_get_dist_code_mmx
  554. movd mm6,ebp
  555. movd mm7,dword ptr [esi]
  556. add esi,4
  557. psllq mm7,mm6
  558. add ebp,32
  559. por mm0,mm7
  560. L_get_dist_code_mmx:
  561. mov ebx, [esp+12]
  562. pand mm5,mm0
  563. movd eax,mm5
  564. movq mm5,mm2
  565. mov eax, [ebx+eax*4]
  566. L_dodist_mmx:
  567. movzx ecx,ah
  568. mov ebx,eax
  569. shr ebx,16
  570. sub ebp,ecx
  571. movd mm1,ecx
  572. test al,16
  573. jz L_test_for_second_level_dist_mmx
  574. and eax,15
  575. jz L_check_dist_one_mmx
  576. L_add_bits_to_dist_mmx:
  577. psrlq mm0,mm1
  578. movd mm1,eax
  579. movd ecx,mm0
  580. sub ebp,eax
  581. and ecx, [inflate_fast_mask+eax*4]
  582. add ebx,ecx
  583. L_check_window_mmx:
  584. mov [esp+44],esi
  585. mov eax,edi
  586. sub eax, [esp+40]
  587. cmp eax,ebx
  588. jb L_clip_window_mmx
  589. mov ecx,edx
  590. mov esi,edi
  591. sub esi,ebx
  592. sub ecx,3
  593. mov al, [esi]
  594. mov [edi],al
  595. mov al, [esi+1]
  596. mov dl, [esi+2]
  597. add esi,3
  598. mov [edi+1],al
  599. mov [edi+2],dl
  600. add edi,3
  601. rep movsb
  602. mov esi, [esp+44]
  603. mov ebx, [esp+8]
  604. jmp L_while_test_mmx
  605. ALIGN 4
  606. L_check_dist_one_mmx:
  607. cmp ebx,1
  608. jne L_check_window_mmx
  609. cmp [esp+40],edi
  610. je L_check_window_mmx
  611. dec edi
  612. mov ecx,edx
  613. mov al, [edi]
  614. sub ecx,3
  615. mov [edi+1],al
  616. mov [edi+2],al
  617. mov [edi+3],al
  618. add edi,4
  619. rep stosb
  620. mov ebx, [esp+8]
  621. jmp L_while_test_mmx
  622. ALIGN 4
  623. L_test_for_second_level_length_mmx:
  624. test al,64
  625. jnz L_test_for_end_of_block
  626. and eax,15
  627. psrlq mm0,mm1
  628. movd ecx,mm0
  629. and ecx, [inflate_fast_mask+eax*4]
  630. add ecx,edx
  631. mov eax, [ebx+ecx*4]
  632. jmp L_dolen_mmx
  633. ALIGN 4
  634. L_test_for_second_level_dist_mmx:
  635. test al,64
  636. jnz L_invalid_distance_code
  637. and eax,15
  638. psrlq mm0,mm1
  639. movd ecx,mm0
  640. and ecx, [inflate_fast_mask+eax*4]
  641. mov eax, [esp+12]
  642. add ecx,ebx
  643. mov eax, [eax+ecx*4]
  644. jmp L_dodist_mmx
  645. ALIGN 4
  646. L_clip_window_mmx:
  647. mov ecx,eax
  648. mov eax, [esp+52]
  649. neg ecx
  650. mov esi, [esp+56]
  651. cmp eax,ebx
  652. jb L_invalid_distance_too_far
  653. add ecx,ebx
  654. cmp dword ptr [esp+48],0
  655. jne L_wrap_around_window_mmx
  656. sub eax,ecx
  657. add esi,eax
  658. cmp edx,ecx
  659. jbe L_do_copy1_mmx
  660. sub edx,ecx
  661. rep movsb
  662. mov esi,edi
  663. sub esi,ebx
  664. jmp L_do_copy1_mmx
  665. cmp edx,ecx
  666. jbe L_do_copy1_mmx
  667. sub edx,ecx
  668. rep movsb
  669. mov esi,edi
  670. sub esi,ebx
  671. jmp L_do_copy1_mmx
  672. L_wrap_around_window_mmx:
  673. mov eax, [esp+48]
  674. cmp ecx,eax
  675. jbe L_contiguous_in_window_mmx
  676. add esi, [esp+52]
  677. add esi,eax
  678. sub esi,ecx
  679. sub ecx,eax
  680. cmp edx,ecx
  681. jbe L_do_copy1_mmx
  682. sub edx,ecx
  683. rep movsb
  684. mov esi, [esp+56]
  685. mov ecx, [esp+48]
  686. cmp edx,ecx
  687. jbe L_do_copy1_mmx
  688. sub edx,ecx
  689. rep movsb
  690. mov esi,edi
  691. sub esi,ebx
  692. jmp L_do_copy1_mmx
  693. L_contiguous_in_window_mmx:
  694. add esi,eax
  695. sub esi,ecx
  696. cmp edx,ecx
  697. jbe L_do_copy1_mmx
  698. sub edx,ecx
  699. rep movsb
  700. mov esi,edi
  701. sub esi,ebx
  702. L_do_copy1_mmx:
  703. mov ecx,edx
  704. rep movsb
  705. mov esi, [esp+44]
  706. mov ebx, [esp+8]
  707. jmp L_while_test_mmx
  708. ; 1174 "inffast.S"
  709. L_invalid_distance_code:
  710. mov ecx, invalid_distance_code_msg
  711. mov edx,INFLATE_MODE_BAD
  712. jmp L_update_stream_state
  713. L_test_for_end_of_block:
  714. test al,32
  715. jz L_invalid_literal_length_code
  716. mov ecx,0
  717. mov edx,INFLATE_MODE_TYPE
  718. jmp L_update_stream_state
  719. L_invalid_literal_length_code:
  720. mov ecx, invalid_literal_length_code_msg
  721. mov edx,INFLATE_MODE_BAD
  722. jmp L_update_stream_state
  723. L_invalid_distance_too_far:
  724. mov esi, [esp+44]
  725. mov ecx, invalid_distance_too_far_msg
  726. mov edx,INFLATE_MODE_BAD
  727. jmp L_update_stream_state
  728. L_update_stream_state:
  729. mov eax, [esp+88]
  730. test ecx,ecx
  731. jz L_skip_msg
  732. mov [eax+24],ecx
  733. L_skip_msg:
  734. mov eax, [eax+28]
  735. mov [eax+mode_state],edx
  736. jmp L_break_loop
  737. ALIGN 4
  738. L_break_loop:
  739. ; 1243 "inffast.S"
  740. cmp dword ptr [inflate_fast_use_mmx],2
  741. jne L_update_next_in
  742. mov ebx,ebp
  743. L_update_next_in:
  744. ; 1266 "inffast.S"
  745. mov eax, [esp+88]
  746. mov ecx,ebx
  747. mov edx, [eax+28]
  748. shr ecx,3
  749. sub esi,ecx
  750. shl ecx,3
  751. sub ebx,ecx
  752. mov [eax+12],edi
  753. mov [edx+bits_state],ebx
  754. mov ecx,ebx
  755. lea ebx, [esp+28]
  756. cmp [esp+20],ebx
  757. jne L_buf_not_used
  758. sub esi,ebx
  759. mov ebx, [eax+0]
  760. mov [esp+20],ebx
  761. add esi,ebx
  762. mov ebx, [eax+4]
  763. sub ebx,11
  764. add [esp+20],ebx
  765. L_buf_not_used:
  766. mov [eax+0],esi
  767. mov ebx,1
  768. shl ebx,cl
  769. dec ebx
  770. cmp dword ptr [inflate_fast_use_mmx],2
  771. jne L_update_hold
  772. psrlq mm0,mm1
  773. movd ebp,mm0
  774. emms
  775. L_update_hold:
  776. and ebp,ebx
  777. mov [edx+hold_state],ebp
  778. mov ebx, [esp+20]
  779. cmp ebx,esi
  780. jbe L_last_is_smaller
  781. sub ebx,esi
  782. add ebx,11
  783. mov [eax+4],ebx
  784. jmp L_fixup_out
  785. L_last_is_smaller:
  786. sub esi,ebx
  787. neg esi
  788. add esi,11
  789. mov [eax+4],esi
  790. L_fixup_out:
  791. mov ebx, [esp+16]
  792. cmp ebx,edi
  793. jbe L_end_is_smaller
  794. sub ebx,edi
  795. add ebx,257
  796. mov [eax+16],ebx
  797. jmp L_done
  798. L_end_is_smaller:
  799. sub edi,ebx
  800. neg edi
  801. add edi,257
  802. mov [eax+16],edi
  803. L_done:
  804. add esp,64
  805. popfd
  806. pop ebx
  807. pop ebp
  808. pop esi
  809. pop edi
  810. ret
  811. _inflate_fast endp
  812. _TEXT ends
  813. end