1;;
2;; Copyright (c) 2020, Intel Corporation
3;;
4;; Redistribution and use in source and binary forms, with or without
5;; modification, are permitted provided that the following conditions are met:
6;;
7;;     * Redistributions of source code must retain the above copyright notice,
8;;       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 the
11;;       documentation and/or other materials provided with the distribution.
12;;     * Neither the name of Intel Corporation nor the names of its contributors
13;;       may be used to endorse or promote products derived from this software
14;;       without specific prior written permission.
15;;
16;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26;;
27
28%include "include/os.asm"
29
30[bits 64]
31default rel
32
33section .data
34
35;; Ethernet FCS CRC32 0x04c11db7
36;; http://www.ietf.org/rfc/rfc1952.txt
37align 64
38MKGLOBAL(crc32_ethernet_fcs_const,data,internal)
39crc32_ethernet_fcs_const:
40        dq 0x00000000e95c1271, 0x00000000ce3371cb   ; 2048-bits fold
41        dq 0x00000000910eeec1, 0x0000000033fff533   ; 1024-bits fold
42        dq 0x000000000cbec0ed, 0x0000000031f8303f   ; 896-bits fold
43        dq 0x0000000057c54819, 0x00000000df068dc2   ; 768-bits fold
44        dq 0x00000000ae0b5394, 0x000000001c279815   ; 640-bits fold
45        dq 0x000000001d9513d7, 0x000000008f352d95   ; 512-bits fold
46        dq 0x00000000af449247, 0x000000003db1ecdc   ; 384-bits fold
47        dq 0x0000000081256527, 0x00000000f1da05aa   ; 256-bits fold
48        dq 0x00000000ccaa009e, 0x00000000ae689191   ; 128-bits fold
49        dq 0x0000000000000000, 0x0000000000000000   ; padding
50	dq 0x00000000ccaa009e, 0x00000000b8bc6765   ; 128-bits to 64-bits fold
51	dq 0x00000001f7011640, 0x00000001db710640   ; 64-bits to 32-bits reduction
52
53;; CRC16 X25 CCITT 0x1021 / initial value = 0xffff
54align 64
55MKGLOBAL(crc16_x25_ccitt_const,data,internal)
56crc16_x25_ccitt_const:
57        dq 0x0000000000009a19, 0x0000000000002df8   ; 2048-b fold
58        dq 0x00000000000068af, 0x000000000000b6c9   ; 1024-b fold
59        dq 0x000000000000c64f, 0x000000000000cd95   ; 896-b fold
60        dq 0x000000000000d341, 0x000000000000b8f2   ; 768-b fold
61        dq 0x0000000000000842, 0x000000000000b072   ; 640-b fold
62        dq 0x00000000000047e3, 0x000000000000922d   ; 512-b fold
63        dq 0x0000000000000e3a, 0x0000000000004d7a   ; 384-b fold
64        dq 0x0000000000005b44, 0x0000000000007762   ; 256-b fold
65        dq 0x00000000000081bf, 0x0000000000008e10   ; 128-b fold
66        dq 0x0000000000000000, 0x0000000000000000   ; padding
67	dq 0x00000000000081bf, 0x0000000000001cbb   ; 128-bits to 64-bits fold
68	dq 0x000000011c581910, 0x0000000000010810   ; 64-bits to 32-bits reduction
69
70%ifdef LINUX
71section .note.GNU-stack noalloc noexec nowrite progbits
72%endif
73