81 unsigned char FAR *
in;
82 unsigned char FAR *last;
83 unsigned char FAR *
out;
84 unsigned char FAR *beg;
85 unsigned char FAR *
end;
86 unsigned char FAR *window;
87 code const FAR *lcode;
88 code const FAR *dcode;
100 #if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) 101 #define PAD_AVAIL_IN 6 102 #define PAD_AVAIL_OUT 258 104 #define PAD_AVAIL_IN 5 105 #define PAD_AVAIL_OUT 257 110 ar.in = strm->next_in;
112 ar.out = strm->next_out;
113 ar.beg = ar.out - (
start - strm->avail_out);
115 ar.wsize = state->
wsize;
116 ar.write = state->
wnext;
117 ar.window = state->
window;
118 ar.hold = state->
hold;
119 ar.bits = state->
bits;
122 ar.lmask = (1U << state->
lenbits) - 1;
123 ar.dmask = (1U << state->
distbits) - 1;
129 while (((
unsigned long)(
void *)ar.in & (
sizeof(ar.hold) / 2 - 1)) != 0) {
130 ar.hold += (
unsigned long)*ar.in++ << ar.
bits;
134 #if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) 135 __asm__ __volatile__ (
137 " movq %%rbp, 8(%%rax)\n" 138 " movq %%rsp, (%%rax)\n" 139 " movq %%rax, %%rsp\n" 140 " movq 16(%%rsp), %%rsi\n" 141 " movq 32(%%rsp), %%rdi\n" 142 " movq 24(%%rsp), %%r9\n" 143 " movq 48(%%rsp), %%r10\n" 144 " movq 64(%%rsp), %%rbp\n" 145 " movq 72(%%rsp), %%r11\n" 146 " movq 80(%%rsp), %%rdx\n" 147 " movl 88(%%rsp), %%ebx\n" 148 " movl 100(%%rsp), %%r12d\n" 149 " movl 104(%%rsp), %%r13d\n" 153 " cmpq %%rdi, %%r10\n" 155 " cmpq %%rsi, %%r9\n" 160 " movq %%r12, %%r8\n" 162 " ja .L_get_length_code_one_time\n" 167 " shlq %%cl, %%rax\n" 168 " orq %%rax, %%rdx\n" 169 " jmp .L_get_length_code_one_time\n" 173 " cmpq %%rdi, %%r10\n" 174 " jbe .L_break_loop\n" 175 " cmpq %%rsi, %%r9\n" 176 " jbe .L_break_loop\n" 179 " movq %%r12, %%r8\n" 181 " ja .L_get_length_code\n" 186 " shlq %%cl, %%rax\n" 187 " orq %%rax, %%rdx\n" 189 ".L_get_length_code:\n" 190 " andq %%rdx, %%r8\n" 191 " movl (%%rbp,%%r8,4), %%eax\n" 195 " shrq %%cl, %%rdx\n" 197 " testb %%al, %%al\n" 198 " jnz .L_test_for_length_base\n" 200 " movq %%r12, %%r8\n" 204 ".L_get_length_code_one_time:\n" 205 " andq %%rdx, %%r8\n" 206 " movl (%%rbp,%%r8,4), %%eax\n" 211 " shrq %%cl, %%rdx\n" 213 " testb %%al, %%al\n" 214 " jnz .L_test_for_length_base\n" 218 " jmp .L_while_test\n" 221 ".L_test_for_length_base:\n" 222 " movl %%eax, %%r14d\n" 223 " shrl $16, %%r14d\n" 227 " jz .L_test_for_second_level_length\n" 229 " jz .L_decode_distance\n" 231 ".L_add_bits_to_len:\n" 233 " xorl %%eax, %%eax\n" 235 " shll %%cl, %%eax\n" 237 " andl %%edx, %%eax\n" 238 " shrq %%cl, %%rdx\n" 239 " addl %%eax, %%r14d\n" 241 ".L_decode_distance:\n" 242 " movq %%r13, %%r8\n" 244 " ja .L_get_distance_code\n" 249 " shlq %%cl, %%rax\n" 250 " orq %%rax, %%rdx\n" 252 ".L_get_distance_code:\n" 253 " andq %%rdx, %%r8\n" 254 " movl (%%r11,%%r8,4), %%eax\n" 257 " movl %%eax, %%r15d\n" 258 " shrl $16, %%r15d\n" 261 " shrq %%cl, %%rdx\n" 265 " jz .L_test_for_second_level_dist\n" 267 " jz .L_check_dist_one\n" 269 ".L_add_bits_to_dist:\n" 271 " xorl %%eax, %%eax\n" 273 " shll %%cl, %%eax\n" 275 " andl %%edx, %%eax\n" 276 " shrq %%cl, %%rdx\n" 277 " addl %%eax, %%r15d\n" 280 " movq %%rsi, %%r8\n" 281 " movq %%rdi, %%rax\n" 282 " subq 40(%%rsp), %%rax\n" 284 " cmpl %%r15d, %%eax\n" 285 " jb .L_clip_window\n" 287 " movl %%r14d, %%ecx\n" 288 " movq %%rdi, %%rsi\n" 289 " subq %%r15, %%rsi\n" 295 " movb (%%rsi), %%al\n" 296 " movb %%al, (%%rdi)\n" 299 " movq %%r8, %%rsi\n" 300 " jmp .L_while_test\n" 304 " movq %%r8, %%rsi\n" 305 " jmp .L_while_test\n" 308 ".L_check_dist_one:\n" 310 " jne .L_check_window\n" 311 " cmpq %%rdi, 40(%%rsp)\n" 312 " je .L_check_window\n" 314 " movl %%r14d, %%ecx\n" 315 " movb -1(%%rdi), %%al\n" 320 " movb %%al, (%%rdi)\n" 325 " jmp .L_while_test\n" 328 ".L_test_for_second_level_length:\n" 330 " jnz .L_test_for_end_of_block\n" 332 " xorl %%eax, %%eax\n" 334 " shll %%cl, %%eax\n" 336 " andl %%edx, %%eax\n" 337 " addl %%r14d, %%eax\n" 338 " movl (%%rbp,%%rax,4), %%eax\n" 342 ".L_test_for_second_level_dist:\n" 344 " jnz .L_invalid_distance_code\n" 346 " xorl %%eax, %%eax\n" 348 " shll %%cl, %%eax\n" 350 " andl %%edx, %%eax\n" 351 " addl %%r15d, %%eax\n" 352 " movl (%%r11,%%rax,4), %%eax\n" 357 " movl %%eax, %%ecx\n" 358 " movl 92(%%rsp), %%eax\n" 361 " cmpl %%r15d, %%eax\n" 362 " jb .L_invalid_distance_too_far\n" 364 " addl %%r15d, %%ecx\n" 365 " cmpl $0, 96(%%rsp)\n" 366 " jne .L_wrap_around_window\n" 368 " movq 56(%%rsp), %%rsi\n" 369 " subl %%ecx, %%eax\n" 370 " addq %%rax, %%rsi\n" 372 " movl %%r14d, %%eax\n" 373 " cmpl %%ecx, %%r14d\n" 376 " subl %%ecx, %%eax\n" 378 " movq %%rdi, %%rsi\n" 379 " subq %%r15, %%rsi\n" 383 ".L_wrap_around_window:\n" 384 " movl 96(%%rsp), %%eax\n" 385 " cmpl %%eax, %%ecx\n" 386 " jbe .L_contiguous_in_window\n" 388 " movl 92(%%rsp), %%esi\n" 389 " addq 56(%%rsp), %%rsi\n" 390 " addq %%rax, %%rsi\n" 391 " subq %%rcx, %%rsi\n" 392 " subl %%eax, %%ecx\n" 394 " movl %%r14d, %%eax\n" 395 " cmpl %%ecx, %%eax\n" 398 " subl %%ecx, %%eax\n" 400 " movq 56(%%rsp), %%rsi\n" 401 " movl 96(%%rsp), %%ecx\n" 402 " cmpl %%ecx, %%eax\n" 405 " subl %%ecx, %%eax\n" 407 " movq %%rdi, %%rsi\n" 408 " subq %%r15, %%rsi\n" 412 ".L_contiguous_in_window:\n" 413 " movq 56(%%rsp), %%rsi\n" 414 " addq %%rax, %%rsi\n" 415 " subq %%rcx, %%rsi\n" 417 " movl %%r14d, %%eax\n" 418 " cmpl %%ecx, %%eax\n" 421 " subl %%ecx, %%eax\n" 423 " movq %%rdi, %%rsi\n" 424 " subq %%r15, %%rsi\n" 429 " movl %%eax, %%ecx\n" 432 " movq %%r8, %%rsi\n" 433 " jmp .L_while_test\n" 435 ".L_test_for_end_of_block:\n" 437 " jz .L_invalid_literal_length_code\n" 438 " movl $1, 116(%%rsp)\n" 439 " jmp .L_break_loop_with_status\n" 441 ".L_invalid_literal_length_code:\n" 442 " movl $2, 116(%%rsp)\n" 443 " jmp .L_break_loop_with_status\n" 445 ".L_invalid_distance_code:\n" 446 " movl $3, 116(%%rsp)\n" 447 " jmp .L_break_loop_with_status\n" 449 ".L_invalid_distance_too_far:\n" 450 " movl $4, 116(%%rsp)\n" 451 " jmp .L_break_loop_with_status\n" 454 " movl $0, 116(%%rsp)\n" 456 ".L_break_loop_with_status:\n" 458 " movq %%rsi, 16(%%rsp)\n" 459 " movq %%rdi, 32(%%rsp)\n" 460 " movl %%ebx, 88(%%rsp)\n" 461 " movq %%rdx, 80(%%rsp)\n" 462 " movq (%%rsp), %%rax\n" 463 " movq 8(%%rsp), %%rbp\n" 464 " movq %%rax, %%rsp\n" 467 :
"memory",
"%rax",
"%rbx",
"%rcx",
"%rdx",
"%rsi",
"%rdi",
468 "%r8",
"%r9",
"%r10",
"%r11",
"%r12",
"%r13",
"%r14",
"%r15" 470 #elif ( defined( __GNUC__ ) || defined( __ICC ) ) && defined( __i386 ) 471 __asm__ __volatile__ (
473 " movl %%esp, (%%eax)\n" 474 " movl %%ebp, 4(%%eax)\n" 475 " movl %%eax, %%esp\n" 476 " movl 8(%%esp), %%esi\n" 477 " movl 16(%%esp), %%edi\n" 478 " movl 40(%%esp), %%edx\n" 479 " movl 44(%%esp), %%ebx\n" 480 " movl 32(%%esp), %%ebp\n" 487 " cmpl %%edi, 24(%%esp)\n" 488 " jbe .L_break_loop\n" 489 " cmpl %%esi, 12(%%esp)\n" 490 " jbe .L_break_loop\n" 494 " ja .L_get_length_code\n" 496 " xorl %%eax, %%eax\n" 500 " shll %%cl, %%eax\n" 501 " orl %%eax, %%edx\n" 503 ".L_get_length_code:\n" 504 " movl 56(%%esp), %%eax\n" 505 " andl %%edx, %%eax\n" 506 " movl (%%ebp,%%eax,4), %%eax\n" 511 " shrl %%cl, %%edx\n" 513 " testb %%al, %%al\n" 514 " jnz .L_test_for_length_base\n" 518 " jmp .L_while_test\n" 521 ".L_test_for_length_base:\n" 522 " movl %%eax, %%ecx\n" 524 " movl %%ecx, 64(%%esp)\n" 528 " jz .L_test_for_second_level_length\n" 530 " jz .L_decode_distance\n" 532 " jae .L_add_bits_to_len\n" 535 " xorl %%eax, %%eax\n" 539 " shll %%cl, %%eax\n" 540 " orl %%eax, %%edx\n" 543 ".L_add_bits_to_len:\n" 545 " xorl %%eax, %%eax\n" 547 " shll %%cl, %%eax\n" 549 " andl %%edx, %%eax\n" 550 " shrl %%cl, %%edx\n" 551 " addl %%eax, 64(%%esp)\n" 553 ".L_decode_distance:\n" 555 " ja .L_get_distance_code\n" 557 " xorl %%eax, %%eax\n" 561 " shll %%cl, %%eax\n" 562 " orl %%eax, %%edx\n" 564 ".L_get_distance_code:\n" 565 " movl 60(%%esp), %%eax\n" 566 " movl 36(%%esp), %%ecx\n" 567 " andl %%edx, %%eax\n" 568 " movl (%%ecx,%%eax,4), %%eax\n" 571 " movl %%eax, %%ebp\n" 575 " shrl %%cl, %%edx\n" 579 " jz .L_test_for_second_level_dist\n" 581 " jz .L_check_dist_one\n" 583 " jae .L_add_bits_to_dist\n" 586 " xorl %%eax, %%eax\n" 590 " shll %%cl, %%eax\n" 591 " orl %%eax, %%edx\n" 594 ".L_add_bits_to_dist:\n" 596 " xorl %%eax, %%eax\n" 598 " shll %%cl, %%eax\n" 600 " andl %%edx, %%eax\n" 601 " shrl %%cl, %%edx\n" 602 " addl %%eax, %%ebp\n" 605 " movl %%esi, 8(%%esp)\n" 606 " movl %%edi, %%eax\n" 607 " subl 20(%%esp), %%eax\n" 609 " cmpl %%ebp, %%eax\n" 610 " jb .L_clip_window\n" 612 " movl 64(%%esp), %%ecx\n" 613 " movl %%edi, %%esi\n" 614 " subl %%ebp, %%esi\n" 620 " movb (%%esi), %%al\n" 621 " movb %%al, (%%edi)\n" 624 " movl 8(%%esp), %%esi\n" 625 " movl 32(%%esp), %%ebp\n" 626 " jmp .L_while_test\n" 630 " movl 8(%%esp), %%esi\n" 631 " movl 32(%%esp), %%ebp\n" 632 " jmp .L_while_test\n" 635 ".L_check_dist_one:\n" 637 " jne .L_check_window\n" 638 " cmpl %%edi, 20(%%esp)\n" 639 " je .L_check_window\n" 641 " movl 64(%%esp), %%ecx\n" 642 " movb -1(%%edi), %%al\n" 647 " movb %%al, (%%edi)\n" 652 " movl 32(%%esp), %%ebp\n" 653 " jmp .L_while_test\n" 656 ".L_test_for_second_level_length:\n" 658 " jnz .L_test_for_end_of_block\n" 660 " xorl %%eax, %%eax\n" 662 " shll %%cl, %%eax\n" 664 " andl %%edx, %%eax\n" 665 " addl 64(%%esp), %%eax\n" 666 " movl (%%ebp,%%eax,4), %%eax\n" 670 ".L_test_for_second_level_dist:\n" 672 " jnz .L_invalid_distance_code\n" 674 " xorl %%eax, %%eax\n" 676 " shll %%cl, %%eax\n" 678 " andl %%edx, %%eax\n" 679 " addl %%ebp, %%eax\n" 680 " movl 36(%%esp), %%ecx\n" 681 " movl (%%ecx,%%eax,4), %%eax\n" 686 " movl %%eax, %%ecx\n" 687 " movl 48(%%esp), %%eax\n" 689 " movl 28(%%esp), %%esi\n" 691 " cmpl %%ebp, %%eax\n" 692 " jb .L_invalid_distance_too_far\n" 694 " addl %%ebp, %%ecx\n" 695 " cmpl $0, 52(%%esp)\n" 696 " jne .L_wrap_around_window\n" 698 " subl %%ecx, %%eax\n" 699 " addl %%eax, %%esi\n" 701 " movl 64(%%esp), %%eax\n" 702 " cmpl %%ecx, %%eax\n" 705 " subl %%ecx, %%eax\n" 707 " movl %%edi, %%esi\n" 708 " subl %%ebp, %%esi\n" 712 ".L_wrap_around_window:\n" 713 " movl 52(%%esp), %%eax\n" 714 " cmpl %%eax, %%ecx\n" 715 " jbe .L_contiguous_in_window\n" 717 " addl 48(%%esp), %%esi\n" 718 " addl %%eax, %%esi\n" 719 " subl %%ecx, %%esi\n" 720 " subl %%eax, %%ecx\n" 722 " movl 64(%%esp), %%eax\n" 723 " cmpl %%ecx, %%eax\n" 726 " subl %%ecx, %%eax\n" 728 " movl 28(%%esp), %%esi\n" 729 " movl 52(%%esp), %%ecx\n" 730 " cmpl %%ecx, %%eax\n" 733 " subl %%ecx, %%eax\n" 735 " movl %%edi, %%esi\n" 736 " subl %%ebp, %%esi\n" 740 ".L_contiguous_in_window:\n" 741 " addl %%eax, %%esi\n" 742 " subl %%ecx, %%esi\n" 744 " movl 64(%%esp), %%eax\n" 745 " cmpl %%ecx, %%eax\n" 748 " subl %%ecx, %%eax\n" 750 " movl %%edi, %%esi\n" 751 " subl %%ebp, %%esi\n" 756 " movl %%eax, %%ecx\n" 759 " movl 8(%%esp), %%esi\n" 760 " movl 32(%%esp), %%ebp\n" 761 " jmp .L_while_test\n" 763 ".L_test_for_end_of_block:\n" 765 " jz .L_invalid_literal_length_code\n" 766 " movl $1, 72(%%esp)\n" 767 " jmp .L_break_loop_with_status\n" 769 ".L_invalid_literal_length_code:\n" 770 " movl $2, 72(%%esp)\n" 771 " jmp .L_break_loop_with_status\n" 773 ".L_invalid_distance_code:\n" 774 " movl $3, 72(%%esp)\n" 775 " jmp .L_break_loop_with_status\n" 777 ".L_invalid_distance_too_far:\n" 778 " movl 8(%%esp), %%esi\n" 779 " movl $4, 72(%%esp)\n" 780 " jmp .L_break_loop_with_status\n" 783 " movl $0, 72(%%esp)\n" 785 ".L_break_loop_with_status:\n" 787 " movl %%esi, 8(%%esp)\n" 788 " movl %%edi, 16(%%esp)\n" 789 " movl %%ebx, 44(%%esp)\n" 790 " movl %%edx, 40(%%esp)\n" 791 " movl 4(%%esp), %%ebp\n" 792 " movl (%%esp), %%esp\n" 795 :
"memory",
"%eax",
"%ebx",
"%ecx",
"%edx",
"%esi",
"%edi" 797 #elif defined( _MSC_VER ) && ! defined( _M_AMD64 ) 841 jnz L_test_for_length_base
848 L_test_for_length_base:
855 jz L_test_for_second_level_length
859 jae L_add_bits_to_len
882 ja L_get_distance_code
906 jz L_test_for_second_level_dist
910 jae L_add_bits_to_dist
983 L_test_for_second_level_length:
985 jnz L_test_for_end_of_block
997 L_test_for_second_level_dist:
999 jnz L_invalid_distance_code
1008 mov eax, [ecx+eax*4]
1019 jb L_invalid_distance_too_far
1022 cmp dword
ptr [esp+52], 0
1023 jne L_wrap_around_window
1039 L_wrap_around_window:
1042 jbe L_contiguous_in_window
1067 L_contiguous_in_window:
1090 L_test_for_end_of_block:
1092 jz L_invalid_literal_length_code
1093 mov dword ptr [esp+72], 1
1094 jmp L_break_loop_with_status
1096 L_invalid_literal_length_code:
1097 mov dword ptr [esp+72], 2
1098 jmp L_break_loop_with_status
1100 L_invalid_distance_code:
1101 mov dword ptr [esp+72], 3
1102 jmp L_break_loop_with_status
1104 L_invalid_distance_too_far:
1106 mov dword ptr [esp+72], 4
1107 jmp L_break_loop_with_status
1110 mov dword ptr [esp+72], 0
1112 L_break_loop_with_status:
1122 #error "x86 architecture not defined" 1125 if (ar.status > 1) {
1127 strm->msg =
"invalid literal/length code";
1128 else if (ar.status == 3)
1129 strm->msg =
"invalid distance code";
1131 strm->msg =
"invalid distance too far back";
1134 else if ( ar.status == 1 ) {
1139 ar.len = ar.bits >> 3;
1141 ar.bits -= ar.len << 3;
1142 ar.hold &= (1U << ar.bits) - 1;
1145 strm->next_in = ar.in;
1146 strm->next_out = ar.out;
1147 strm->avail_in = (unsigned)(ar.in < ar.last ?
1150 strm->avail_out = (unsigned)(ar.out < ar.end ?
1153 state->
hold = ar.hold;
1154 state->
bits = ar.bits;
int write(int fd, const char *buf, int nbytes)
code const FAR * distcode
void inflate_fast(z_streamp strm, unsigned start)
local int out(void *out_desc, unsigned char *buf, unsigned len)
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
unsigned char FAR * window