Home | History | Annotate | Download | only in lzo
      1 /* lzo1c_d.ash -- assembler implementation of the LZO1C 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 (at) oberhumer.com>
     25    http://www.oberhumer.com/opensource/lzo/
     26  */
     27 
     28 
     29 /***********************************************************************
     30 //
     31 ************************************************************************/
     32 
     33         ALIGN3
     34 .L1:
     35         xorl    %eax,%eax
     36         movb    (%esi),%al
     37         incl    %esi
     38         cmpb    $32,%al
     39         jnb     .LMATCH
     40 
     41         orb     %al,%al
     42         jz      .L12
     43         movl    %eax,%ecx
     44 .LIT:
     45         TEST_OP((%edi,%ecx),%ebx)
     46         TEST_IP((%esi,%ecx),%ebx)
     47         rep
     48         movsb
     49 .LM1:
     50         movb    (%esi),%al
     51         incl    %esi
     52 
     53         cmpb    $32,%al
     54         jb      .LM2
     55 .LMATCH:
     56         cmpb    $64,%al
     57         jb      .LN3
     58 
     59         movl    %eax,%ecx
     60         andb    $31,%al
     61         leal    -1(%edi),%edx
     62         shrl    $5,%ecx
     63         subl    %eax,%edx
     64         movb    (%esi),%al
     65         incl    %esi
     66 
     67         shll    $5,%eax
     68         subl    %eax,%edx
     69         incl    %ecx
     70         xchgl   %esi,%edx
     71         TEST_LOOKBEHIND(%esi)
     72         TEST_OP((%edi,%ecx),%ebx)
     73         rep
     74         movsb
     75         movl    %edx,%esi
     76         jmp     .L1
     77 
     78         ALIGN3
     79 .L12:
     80         LODSB
     81         leal    32(%eax),%ecx
     82         cmpb    $248,%al
     83         jb      .LIT
     84 
     85         movl    $280,%ecx
     86         subb    $248,%al
     87         jz      .L11
     88         xchgl   %eax,%ecx
     89         xorb    %al,%al
     90         shll    %cl,%eax
     91         xchgl   %eax,%ecx
     92 .L11:
     93         TEST_OP((%edi,%ecx),%ebx)
     94         TEST_IP((%esi,%ecx),%ebx)
     95         rep
     96         movsb
     97         jmp     .L1
     98 
     99         ALIGN3
    100 .LM2:
    101         leal    -1(%edi),%edx
    102         subl    %eax,%edx
    103         LODSB
    104         shll    $5,%eax
    105         subl    %eax,%edx
    106         xchgl   %esi,%edx
    107         TEST_LOOKBEHIND(%esi)
    108         TEST_OP(4(%edi),%ebx)
    109         movsb
    110         movsb
    111         movsb
    112         movl    %edx,%esi
    113         movsb
    114         xorl    %eax,%eax
    115         jmp     .LM1
    116 .LN3:
    117         andb    $31,%al
    118         movl    %eax,%ecx
    119         jnz     .LN6
    120         movb    $31,%cl
    121 .LN4:
    122         LODSB
    123         orb     %al,%al
    124         jnz     .LN5
    125         addl    N_255,%ecx
    126         jmp     .LN4
    127 
    128         ALIGN3
    129 .LN5:
    130         addl    %eax,%ecx
    131 .LN6:
    132         movb    (%esi),%al
    133         incl    %esi
    134 
    135         movl    %eax,%ebx
    136         andb    $63,%al
    137         movl    %edi,%edx
    138         subl    %eax,%edx
    139 
    140         movb    (%esi),%al
    141         incl    %esi
    142 
    143         shll    $6,%eax
    144         subl    %eax,%edx
    145         cmpl    %edi,%edx
    146         jz      .LEOF
    147 
    148         xchgl   %edx,%esi
    149         leal    3(%ecx),%ecx
    150         TEST_LOOKBEHIND(%esi)
    151         TEST_OP((%edi,%ecx),%eax)
    152         rep
    153         movsb
    154 
    155         movl    %edx,%esi
    156         xorl    %eax,%eax
    157         shrl    $6,%ebx
    158         movl    %ebx,%ecx
    159         jnz     .LIT
    160         jmp     .L1
    161 
    162 .LEOF:
    163 /****   xorl    %eax,%eax          eax=0 from above */
    164 
    165         cmpl    $1,%ecx         /* ecx must be 1 */
    166         setnz   %al
    167 
    168 
    169 /*
    170 vi:ts=4
    171 */
    172 
    173