1/* lzo1f_d.ash -- assembler implementation of the LZO1F decompression algorithm 2 3 This file is part of the LZO real-time data compression library. 4 5 Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer 6 All Rights Reserved. 7 8 The LZO library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License as 10 published by the Free Software Foundation; either version 2 of 11 the License, or (at your option) any later version. 12 13 The LZO library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with the LZO library; see the file COPYING. 20 If not, write to the Free Software Foundation, Inc., 21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 23 Markus F.X.J. Oberhumer 24 <markus@oberhumer.com> 25 http://www.oberhumer.com/opensource/lzo/ 26 */ 27 28 29/*********************************************************************** 30// 31************************************************************************/ 32 33 ALIGN3 34.L0: 35 xorl %eax,%eax 36 movb (%esi),%al 37 incl %esi 38 cmpb $31,%al 39 ja .LM2 40 41 orb %al,%al 42 movl %eax,%ecx 43 jnz .L2 441: 45 LODSB 46 orb %al,%al 47 jnz 2f 48 addl N_255,%ecx 49 jmp 1b 502: 51 lea 31(%eax,%ecx),%ecx 52.L2: 53 TEST_OP((%edi,%ecx),%ebx) 54 TEST_IP((%esi,%ecx),%ebx) 55 movb %cl,%al 56 shrl $2,%ecx 57 rep 58 movsl 59 andb $3,%al 60 jz 1f 61 movl (%esi),%ebx 62 addl %eax,%esi 63 movl %ebx,(%edi) 64 addl %eax,%edi 651: 66 movb (%esi),%al 67 incl %esi 68.LM1: 69 cmpb $31,%al 70 jbe .LM21 71 72.LM2: 73 cmpb $223,%al 74 ja .LM3 75 76 movl %eax,%ecx 77 shrl $2,%eax 78 lea -1(%edi),%edx 79 andb $7,%al 80 shrl $5,%ecx 81 movl %eax,%ebx 82 83 movb (%esi),%al 84 leal (%ebx,%eax,8),%eax 85 incl %esi 86.LM5: 87 subl %eax,%edx 88 addl $2,%ecx 89 xchgl %edx,%esi 90 TEST_LOOKBEHIND(%esi) 91 TEST_OP((%edi,%ecx),%ebx) 92 cmpl $6,%ecx 93 jb 1f 94 cmpl $4,%eax 95 jb 1f 96 movb %cl,%al 97 shrl $2,%ecx 98 rep 99 movsl 100 andb $3,%al 101 movb %al,%cl 1021: 103 rep 104 movsb 105 movl %edx,%esi 106.LN1: 107 movb -2(%esi),%cl 108 andl $3,%ecx 109 jz .L0 110 movl (%esi),%eax 111 addl %ecx,%esi 112 movl %eax,(%edi) 113 addl %ecx,%edi 114 xorl %eax,%eax 115 movb (%esi),%al 116 incl %esi 117 jmp .LM1 118.LM21: 119 TEST_OP(3(%edi),%edx) 120 shrl $2,%eax 121 leal -0x801(%edi),%edx 122 movl %eax,%ecx 123 movb (%esi),%al 124 incl %esi 125 leal (%ecx,%eax,8),%eax 126 subl %eax,%edx 127 TEST_LOOKBEHIND(%edx) 128 movl (%edx),%eax 129 movl %eax,(%edi) 130 addl $3,%edi 131 jmp .LN1 1321: 133 LODSB 134 orb %al,%al 135 jnz 2f 136 addl N_255,%ecx 137 jmp 1b 1382: 139 lea 31(%eax,%ecx),%ecx 140 jmp .LM4 141 142 ALIGN3 143.LM3: 144 andb $31,%al 145 movl %eax,%ecx 146 jz 1b 147.LM4: 148 movl %edi,%edx 149 movw (%esi),%ax 150 addl $2,%esi 151 shrl $2,%eax 152 jnz .LM5 153 154.LEOF: 155/**** xorl %eax,%eax eax=0 from above */ 156 157 cmpl $1,%ecx /* ecx must be 1 */ 158 setnz %al 159 160 161/* 162vi:ts=4 163*/ 164 165