xref: /isa-l/igzip/rfc1951_lookup.asm (revision ede04f0a1f4d7ea00cbd13d33c9db35d17575a38)
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2;  Copyright(c) 2011-2018 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%include "reg_sizes.asm"
31
32%ifndef	RFC1951_LOOKUP
33%define	RFC1951_LOOKUP
34
35section .data
36
37	align	8
38
39;; /* Structure contain lookup data based on RFC 1951 */
40;; struct rfc1951_tables {
41;;	uint8_t len_to_code[264];
42;; 	uint8_t dist_extra_bit_count[32];
43;; 	uint32_t dist_start[32];
44;; 	uint8_t len_extra_bit_count[32];
45;; 	uint16_t len_start[32];
46;; };
47
48mk_global rfc1951_lookup_table, data, internal
49rfc1951_lookup_table:
50len_to_code:
51	db	0x00, 0x00, 0x00
52	db	0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
53	db	0x09, 0x09, 0x0a, 0x0a, 0x0b, 0x0b, 0x0c, 0x0c
54	db	0x0d, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e
55	db	0x0f, 0x0f, 0x0f, 0x0f, 0x10, 0x10, 0x10, 0x10
56	db	0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11
57	db	0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12
58	db	0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13
59	db	0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14
60	db	0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15
61	db	0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15
62	db	0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16
63	db	0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16
64	db 	0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17
65	db	0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17
66	db	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18
67	db	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18
68	db	0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19
69	db	0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19
70	db 	0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19
71	db	0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19
72	db	0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a
73	db	0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a
74	db	0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a
75	db	0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a
76	db	0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b
77	db	0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b
78	db	0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b
79	db	0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b
80	db	0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c
81	db	0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c
82	db	0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c
83	db	0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1d
84	db	0x00, 0x00, 0x00, 0x00, 0x00
85
86dist_extra_bit_count:
87	db	0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02
88	db	0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06
89	db	0x07, 0x07, 0x08, 0x08, 0x09, 0x09, 0x0a, 0x0a
90	db	0x0b, 0x0b, 0x0c, 0x0c, 0x0d, 0x0d, 0x00, 0x00
91
92dist_start:
93	dd	0x00000001, 0x00000002, 0x00000003, 0x00000004
94	dd	0x00000005, 0x00000007, 0x00000009, 0x0000000d
95	dd	0x00000011, 0x00000019, 0x00000021, 0x00000031
96	dd	0x00000041, 0x00000061, 0x00000081, 0x000000c1
97	dd	0x00000101, 0x00000181, 0x00000201, 0x00000301
98	dd	0x00000401, 0x00000601, 0x00000801, 0x00000c01
99	dd	0x00001001, 0x00001801, 0x00002001, 0x00003001
100	dd	0x00004001, 0x00006001, 0x00000000, 0x00000000
101
102len_extra_bit_count:
103	db	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
104	db	0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02
105	db	0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04
106	db	0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00
107
108len_start:
109	dw	0x0003, 0x0004, 0x0005, 0x0006
110	dw	000007, 0x0008, 0x0009, 0x000a
111	dw	0x000b, 0x000d, 0x000f, 0x0011
112	dw	0x0013, 0x0017, 0x001b, 0x001f
113	dw	0x0023, 0x002b, 0x0033, 0x003b
114	dw	0x0043, 0x0053, 0x0063, 0x0073
115	dw	0x0083, 0x00a3, 0x00c3, 0x00e3
116	dw	0x0102, 0x0000, 0x0000, 0x0000
117
118%endif 	; RFC1951_LOOKUP
119