]> git.proxmox.com Git - ceph.git/blame - ceph/src/isa-l/igzip/inflate_data_structs.asm
Import ceph 15.2.8
[ceph.git] / ceph / src / isa-l / igzip / inflate_data_structs.asm
CommitLineData
224ce89b
WB
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2; Copyright(c) 2011-2016 Intel Corporation All rights reserved.
3;
4; Redistribution and use in source and binary forms, with or without
5; modification, are permitted provided that the following conditions
6; are met:
7; * Redistributions of source code must retain the above copyright
8; notice, this list of conditions and the following disclaimer.
9; * Redistributions in binary form must reproduce the above copyright
10; notice, this list of conditions and the following disclaimer in
11; the documentation and/or other materials provided with the
12; distribution.
13; * Neither the name of Intel Corporation nor the names of its
14; contributors may be used to endorse or promote products derived
15; from this software without specific prior written permission.
16;
17; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29
30;; START_FIELDS
31%macro START_FIELDS 0
32%assign _FIELD_OFFSET 0
33%assign _STRUCT_ALIGN 0
34%endm
35
36;; FIELD name size align
37%macro FIELD 3
38%define %%name %1
39%define %%size %2
40%define %%align %3
41
42%assign _FIELD_OFFSET (_FIELD_OFFSET + (%%align) - 1) & (~ ((%%align)-1))
43%%name equ _FIELD_OFFSET
44%assign _FIELD_OFFSET _FIELD_OFFSET + (%%size)
45%if (%%align > _STRUCT_ALIGN)
46%assign _STRUCT_ALIGN %%align
47%endif
48%endm
49
f91f0fd5
TL
50;; See inflate_huff_code structure declaration in igzip_lib.h calculation explanation
51%define L_REM (21 - ISAL_DECODE_LONG_BITS)
52%define S_REM (15 - ISAL_DECODE_SHORT_BITS)
53
54%define L_DUP ((1 << L_REM) - (L_REM + 1))
55%define S_DUP ((1 << S_REM) - (S_REM + 1))
56
57%define L_UNUSED ((1 << L_REM) - (1 << ((L_REM)/2)) - (1 << ((L_REM + 1)/2)) + 1)
58%define S_UNUSED ((1 << S_REM) - (1 << ((S_REM)/2)) - (1 << ((S_REM + 1)/2)) + 1)
59
60%define L_SIZE (286 + L_DUP + L_UNUSED)
61%define S_SIZE (30 + S_DUP + S_UNUSED)
62
63%define HUFF_CODE_LARGE_LONG_ALIGNED (L_SIZE + (-L_SIZE & 0xf))
64%define HUFF_CODE_SMALL_LONG_ALIGNED (S_SIZE + (-S_SIZE & 0xf))
65
66%define MAX_LONG_CODE_LARGE (L_SIZE + (-L_SIZE & 0xf))
67%define MAX_LONG_CODE_SMALL (S_SIZE + (-S_SIZE & 0xf))
68
69%define LARGE_SHORT_CODE_SIZE 4
70%define LARGE_LONG_CODE_SIZE 2
71
72%define SMALL_SHORT_CODE_SIZE 2
73%define SMALL_LONG_CODE_SIZE 2
74
224ce89b
WB
75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
78
79START_FIELDS ;; inflate huff code
80
81;; name size align
f91f0fd5
TL
82FIELD _short_code_lookup_large, LARGE_SHORT_CODE_SIZE * (1 << (ISAL_DECODE_LONG_BITS)), LARGE_LONG_CODE_SIZE
83FIELD _long_code_lookup_large, LARGE_LONG_CODE_SIZE * MAX_LONG_CODE_LARGE, LARGE_SHORT_CODE_SIZE
224ce89b
WB
84
85%assign _inflate_huff_code_large_size _FIELD_OFFSET
86%assign _inflate_huff_code_large_align _STRUCT_ALIGN
87
88;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
90;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
91
92START_FIELDS ;; inflate huff code
93
94;; name size align
f91f0fd5
TL
95FIELD _short_code_lookup_small, SMALL_SHORT_CODE_SIZE * (1 << (ISAL_DECODE_SHORT_BITS)), SMALL_LONG_CODE_SIZE
96FIELD _long_code_lookup_small, SMALL_LONG_CODE_SIZE * MAX_LONG_CODE_SMALL, SMALL_SHORT_CODE_SIZE
224ce89b
WB
97
98%assign _inflate_huff_code_small_size _FIELD_OFFSET
99%assign _inflate_huff_code_small_align _STRUCT_ALIGN
100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
103
104START_FIELDS ;; inflate state
105
106;; name size align
107FIELD _next_out, 8, 8
108FIELD _avail_out, 4, 4
109FIELD _total_out, 4, 4
110FIELD _next_in, 8, 8
111FIELD _read_in, 8, 8
112FIELD _avail_in, 4, 4
113FIELD _read_in_length,4, 4
114FIELD _lit_huff_code, _inflate_huff_code_large_size, _inflate_huff_code_large_align
115FIELD _dist_huff_code,_inflate_huff_code_small_size, _inflate_huff_code_small_align
116FIELD _block_state, 4, 4
f91f0fd5 117FIELD _dict_length, 4, 4
224ce89b
WB
118FIELD _bfinal, 4, 4
119FIELD _crc_flag, 4, 4
120FIELD _crc, 4, 4
f91f0fd5 121FIELD _hist_bits, 4, 4
224ce89b 122FIELD _type0_block_len, 4, 4
f91f0fd5
TL
123FIELD _write_overflow_lits, 4, 4
124FIELD _write_overflow_len, 4, 4
224ce89b
WB
125FIELD _copy_overflow_len, 4, 4
126FIELD _copy_overflow_dist, 4, 4
127
128%assign _inflate_state_size _FIELD_OFFSET
129%assign _inflate_state_align _STRUCT_ALIGN
130
131_lit_huff_code_short_code_lookup equ _lit_huff_code+_short_code_lookup_large
132_lit_huff_code_long_code_lookup equ _lit_huff_code+_long_code_lookup_large
133
134_dist_huff_code_short_code_lookup equ _dist_huff_code+_short_code_lookup_small
135_dist_huff_code_long_code_lookup equ _dist_huff_code+_long_code_lookup_small
136
137ISAL_BLOCK_NEW_HDR equ 0
138ISAL_BLOCK_HDR equ 1
139ISAL_BLOCK_TYPE0 equ 2
140ISAL_BLOCK_CODED equ 3
f91f0fd5 141ISAL_BLOCK_INPUT_DONE equ 4
224ce89b
WB
142ISAL_BLOCK_FINISH equ 5
143;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
144;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
145;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
146