📄 nrv2e_d32.s
字号:
/*; n2e_d32.ash -- ucl_nrv2e_decompress_le32 in 32-bit assembly;; This file is part of the UCL data compression library.;; Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer; All Rights Reserved.;; The UCL library is free software; you can redistribute it and/or; modify it under the terms of the GNU General Public License as; published by the Free Software Foundation; either version 2 of; the License, or (at your option) any later version.;; The UCL library is distributed in the hope that it will be useful,; but WITHOUT ANY WARRANTY; without even the implied warranty of; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License; along with the UCL library; see the file COPYING.; If not, write to the Free Software Foundation, Inc.,; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.;; Markus F.X.J. Oberhumer; <markus@oberhumer.com>; http://www.oberhumer.com/opensource/ucl/;; ------------- DECOMPRESSION -------------; Input:; esi - source; edi - dest; ebp - -1; cld; Output:; eax - 0; ecx - 0*/.macro getbit_n2e one local l1 .ifc \one, 1 add ebx, ebx jnzs l1 .endif mov ebx, [esi] sub esi, -4 adc ebx, ebxl1:.endm#undef getbit#define getbit getbit_n2esection N2ESMA10 jmps dcl1_n2edecompr_literals_n2e: movsbsection N2EFAS10 jmps dcl1_n2esection N2EFAS11decompr_literalb_n2e: mov al, [esi] inc esi mov [edi], al inc edisection N2EDEC10decompr_loop_n2e: add ebx, ebx jnz dcl2_n2edcl1_n2e: getbit 32dcl2_n2e:section N2ESMA20 jcs decompr_literals_n2e xor eax, eax inc eaxsection N2EFAS20#ifndef UPX102 mov al, [edi] // force data cache allocate (PentiumPlain or MMX)#endif jcs decompr_literalb_n2e mov eax, 1section N2EDEC20loop1_n2e: getbit 1 adc eax, eaxsection N2ESMA30 getbit 1 jcs loopend1_n2esection N2EFAS30 add ebx, ebx jnc loopcontinue1_n2e jnzs loopend1_n2e getbit 32 jcs loopend1_n2eloopcontinue1_n2e:section N2EDEC30 dec eax getbit 1 adc eax, eax jmps loop1_n2edecompr_mlen1_n2e: getbit 1 adc ecx, ecx jmps decompr_got_mlen_n2eloopend1_n2e: xor ecx, ecx sub eax, 3 jb decompr_prev_dist_n2e shl eax, 8 mov al, [esi] inc esi xor eax, -1 jzs decompr_end_n2e sar eax, 1 // shift low-bit into carry mov ebp, eax jmps decompr_ebpeax_n2edecompr_prev_dist_n2e: getbit 1decompr_ebpeax_n2e: jcs decompr_mlen1_n2e inc ecx getbit 1 jcs decompr_mlen1_n2eloop2_n2e: getbit 1 adc ecx, ecxsection N2ESMA40 getbit 1 jncs loop2_n2esection N2EFAS40 add ebx, ebx jncs loop2_n2e jnz loopend2_n2e getbit 32 jncs loop2_n2eloopend2_n2e:section N2ESMA50 inc ecx inc ecxsection N2EFAS50 add ecx, 2section N2EDEC50decompr_got_mlen_n2e: cmp ebp, -0x500 adc ecx, 2section N2ESMA60#ifndef UPX102 push esi#else mov edx, esi#endif lea esi, [edi+ebp] rep movsb#ifndef UPX102 pop esi#else mov esi, edx#endif jmp decompr_loop_n2esection N2EFAS60 lea edx, [edi+ebp] cmp ebp, -4#ifndef UPX102 mov al, [edi+ecx] // force data cache allocate (PentiumPlain or MMX)#endif jbes decompr_copy4_n2eloop3_n2e: mov al, [edx] inc edx mov [edi], al inc edi dec ecx jnz loop3_n2e jmp decompr_loop_n2esection N2EFAS61decompr_copy4_n2e: mov eax, [edx] add edx, 4 mov [edi], eax add edi, 4 sub ecx, 4 ja decompr_copy4_n2e add edi, ecx jmp decompr_loop_n2esection N2EDEC60decompr_end_n2e:// vi:ts=8:et
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -