lzma ELF minimal CLzmaDecoderState each time

This commit is contained in:
John Reiser
2006-06-24 14:44:40 -07:00
parent 4eb505755e
commit 02bc48925a
11 changed files with 5759 additions and 5735 deletions
File diff suppressed because it is too large Load Diff
+519 -518
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+575 -574
View File
File diff suppressed because it is too large Load Diff
+34 -23
View File
@@ -83,45 +83,56 @@
; __LZMA_ELF00__ ; __LZMA_ELF00__
; ;
LZMA_BASE_SIZE equ 1846
LZMA_LIT_SIZE equ 768
%ifndef O_OUTS ; ELF defines them, others do not care %ifndef O_OUTS ; ELF defines them, others do not care
%define O_OUTS 0 %define O_OUTS 0
%define O_INS 0 %define O_INS 0
%endif %endif
mov ebp, esp ; save stack mov ebp, esp ; save stack
lea ebx, [esp -0x4000] ; 16KB enough?
xor eax, eax xor eax,eax ; 0
lodsb ; al= 1 byte for LzmaDecodeProperties()
mov dl,9
div dl ; (ah:rem, al:quo)= ax / dl
mov cl,ah ; cl = lit_context_bits
movzx eax,al ; 1st_byte / 9
mov dl,5
div dl ; ah= lit_pos_bits; al= pos_bits
mov ch,cl ; ch = lit_context_bits
add cl,ah ; cl = lit_context_bits + lit_pos_bits;
mov ebx, -LZMA_LIT_SIZE
sal ebx, cl
add ebx, -LZMA_BASE_SIZE
; /* inSizeProcessed, outSizeProcessed, *_bits, CLzmaDecoderState */
lea ebx,[-(2*4 +4) + 2*ebx + esp]
and ebx, byte (~0<<4) ; 16-byte align
.elf_clearstack1: .elf_clearstack1:
push eax push byte 0
cmp esp, ebx cmp esp,ebx
jne .elf_clearstack1 jne .elf_clearstack1
lodsb ; al= 1 byte for LzmaDecodeProperties()
push ebx ; &outSizeProcessed push ebx ; &outSizeProcessed
add ebx, 4 add ebx, 4
mov ecx,[O_OUTS + ebp] ; &outSize mov edx,[O_OUTS + ebp] ; &outSize
push dword [ecx] ; outSize push dword [edx] ; outSize
push edi ; out push edi ; out
push ebx ; &inSizeProcessed push ebx ; &inSizeProcessed
add ebx, 4 add ebx, 4
mov ecx,[O_INS + ebp] mov edx,[O_INS + ebp]
dec ecx ; 1 byte for LzmaDecodeProperties() dec edx ; 1 byte for LzmaDecodeProperties()
push ecx ; inSize push edx ; inSize
push esi ; in push esi ; in
push ebx ; &CLzmaDecoderState push ebx ; &CLzmaDecoderState
push eax ; return address slot (dummy CALL) push eax ; return address slot (dummy CALL)
mov cl,9 mov [ ebx],ch ; store lit_context_bits
div cl ; (ah:rem, al:quo)= ax / cl mov [1+ ebx],ah ; store lit_pos_bits
mov [0+ ebx],ah ; store lit_context_bits (remainder) mov [2+ ebx],al ; store pos_bits
movzx eax,al ; param / 9
mov cl,5
div cl
mov [1+ ebx],ah ; store lit_pos_bits (remainder)
mov [2+ ebx],al ; store pos_bits (quotient)
; __LZMA_DEC10__ ; __LZMA_DEC10__
%include "arch/i386/lzma_d_cs.ash" %include "arch/i386/lzma_d_cs.ash"