1 | /* leave.ash -- LZO assembler stuff |
---|
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 | /* check uncompressed size */ |
---|
34 | #if defined(LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT) |
---|
35 | cmpl OUTEND,%edi |
---|
36 | ja .L_output_overrun |
---|
37 | #endif |
---|
38 | |
---|
39 | /* check compressed size */ |
---|
40 | movl INP,%edx |
---|
41 | addl INS,%edx |
---|
42 | cmpl %edx,%esi /* check compressed size */ |
---|
43 | ja .L_input_overrun |
---|
44 | jb .L_input_not_consumed |
---|
45 | |
---|
46 | .L_leave: |
---|
47 | subl OUTP,%edi /* write back the uncompressed size */ |
---|
48 | movl OUTS,%edx |
---|
49 | movl %edi,(%edx) |
---|
50 | |
---|
51 | negl %eax |
---|
52 | addl $12,%esp |
---|
53 | popl %edx |
---|
54 | popl %ecx |
---|
55 | popl %ebx |
---|
56 | popl %esi |
---|
57 | popl %edi |
---|
58 | popl %ebp |
---|
59 | #if 1 |
---|
60 | ret |
---|
61 | #else |
---|
62 | jmp .L_end |
---|
63 | #endif |
---|
64 | |
---|
65 | |
---|
66 | .L_error: |
---|
67 | movl $1,%eax /* LZO_E_ERROR */ |
---|
68 | jmp .L_leave |
---|
69 | |
---|
70 | .L_input_not_consumed: |
---|
71 | movl $8,%eax /* LZO_E_INPUT_NOT_CONSUMED */ |
---|
72 | jmp .L_leave |
---|
73 | |
---|
74 | .L_input_overrun: |
---|
75 | movl $4,%eax /* LZO_E_INPUT_OVERRUN */ |
---|
76 | jmp .L_leave |
---|
77 | |
---|
78 | #if defined(LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT) |
---|
79 | .L_output_overrun: |
---|
80 | movl $5,%eax /* LZO_E_OUTPUT_OVERRUN */ |
---|
81 | jmp .L_leave |
---|
82 | #endif |
---|
83 | |
---|
84 | #if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) |
---|
85 | .L_lookbehind_overrun: |
---|
86 | movl $6,%eax /* LZO_E_LOOKBEHIND_OVERRUN */ |
---|
87 | jmp .L_leave |
---|
88 | #endif |
---|
89 | |
---|
90 | #if defined(LZO_DEBUG) |
---|
91 | .L_assert_fail: |
---|
92 | movl $99,%eax |
---|
93 | jmp .L_leave |
---|
94 | #endif |
---|
95 | |
---|
96 | .L_end: |
---|
97 | |
---|
98 | |
---|
99 | /* |
---|
100 | vi:ts=4 |
---|
101 | */ |
---|
102 | |
---|