inffas32.asm 16 KB

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