jpayne@69
|
1 /* SPDX-License-Identifier: 0BSD */
|
jpayne@69
|
2
|
jpayne@69
|
3 /**
|
jpayne@69
|
4 * \file lzma/bcj.h
|
jpayne@69
|
5 * \brief Branch/Call/Jump conversion filters
|
jpayne@69
|
6 * \note Never include this file directly. Use <lzma.h> instead.
|
jpayne@69
|
7 */
|
jpayne@69
|
8
|
jpayne@69
|
9 /*
|
jpayne@69
|
10 * Author: Lasse Collin
|
jpayne@69
|
11 */
|
jpayne@69
|
12
|
jpayne@69
|
13 #ifndef LZMA_H_INTERNAL
|
jpayne@69
|
14 # error Never include this file directly. Use <lzma.h> instead.
|
jpayne@69
|
15 #endif
|
jpayne@69
|
16
|
jpayne@69
|
17
|
jpayne@69
|
18 /* Filter IDs for lzma_filter.id */
|
jpayne@69
|
19
|
jpayne@69
|
20 /**
|
jpayne@69
|
21 * \brief Filter for x86 binaries
|
jpayne@69
|
22 */
|
jpayne@69
|
23 #define LZMA_FILTER_X86 LZMA_VLI_C(0x04)
|
jpayne@69
|
24
|
jpayne@69
|
25 /**
|
jpayne@69
|
26 * \brief Filter for Big endian PowerPC binaries
|
jpayne@69
|
27 */
|
jpayne@69
|
28 #define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05)
|
jpayne@69
|
29
|
jpayne@69
|
30 /**
|
jpayne@69
|
31 * \brief Filter for IA-64 (Itanium) binaries
|
jpayne@69
|
32 */
|
jpayne@69
|
33 #define LZMA_FILTER_IA64 LZMA_VLI_C(0x06)
|
jpayne@69
|
34
|
jpayne@69
|
35 /**
|
jpayne@69
|
36 * \brief Filter for ARM binaries
|
jpayne@69
|
37 */
|
jpayne@69
|
38 #define LZMA_FILTER_ARM LZMA_VLI_C(0x07)
|
jpayne@69
|
39
|
jpayne@69
|
40 /**
|
jpayne@69
|
41 * \brief Filter for ARM-Thumb binaries
|
jpayne@69
|
42 */
|
jpayne@69
|
43 #define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08)
|
jpayne@69
|
44
|
jpayne@69
|
45 /**
|
jpayne@69
|
46 * \brief Filter for SPARC binaries
|
jpayne@69
|
47 */
|
jpayne@69
|
48 #define LZMA_FILTER_SPARC LZMA_VLI_C(0x09)
|
jpayne@69
|
49
|
jpayne@69
|
50 /**
|
jpayne@69
|
51 * \brief Filter for ARM64 binaries
|
jpayne@69
|
52 */
|
jpayne@69
|
53 #define LZMA_FILTER_ARM64 LZMA_VLI_C(0x0A)
|
jpayne@69
|
54
|
jpayne@69
|
55 /**
|
jpayne@69
|
56 * \brief Filter for RISC-V binaries
|
jpayne@69
|
57 */
|
jpayne@69
|
58 #define LZMA_FILTER_RISCV LZMA_VLI_C(0x0B)
|
jpayne@69
|
59
|
jpayne@69
|
60
|
jpayne@69
|
61 /**
|
jpayne@69
|
62 * \brief Options for BCJ filters
|
jpayne@69
|
63 *
|
jpayne@69
|
64 * The BCJ filters never change the size of the data. Specifying options
|
jpayne@69
|
65 * for them is optional: if pointer to options is NULL, default value is
|
jpayne@69
|
66 * used. You probably never need to specify options to BCJ filters, so just
|
jpayne@69
|
67 * set the options pointer to NULL and be happy.
|
jpayne@69
|
68 *
|
jpayne@69
|
69 * If options with non-default values have been specified when encoding,
|
jpayne@69
|
70 * the same options must also be specified when decoding.
|
jpayne@69
|
71 *
|
jpayne@69
|
72 * \note At the moment, none of the BCJ filters support
|
jpayne@69
|
73 * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified,
|
jpayne@69
|
74 * LZMA_OPTIONS_ERROR will be returned. If there is need,
|
jpayne@69
|
75 * partial support for LZMA_SYNC_FLUSH can be added in future.
|
jpayne@69
|
76 * Partial means that flushing would be possible only at
|
jpayne@69
|
77 * offsets that are multiple of 2, 4, or 16 depending on
|
jpayne@69
|
78 * the filter, except x86 which cannot be made to support
|
jpayne@69
|
79 * LZMA_SYNC_FLUSH predictably.
|
jpayne@69
|
80 */
|
jpayne@69
|
81 typedef struct {
|
jpayne@69
|
82 /**
|
jpayne@69
|
83 * \brief Start offset for conversions
|
jpayne@69
|
84 *
|
jpayne@69
|
85 * This setting is useful only when the same filter is used
|
jpayne@69
|
86 * _separately_ for multiple sections of the same executable file,
|
jpayne@69
|
87 * and the sections contain cross-section branch/call/jump
|
jpayne@69
|
88 * instructions. In that case it is beneficial to set the start
|
jpayne@69
|
89 * offset of the non-first sections so that the relative addresses
|
jpayne@69
|
90 * of the cross-section branch/call/jump instructions will use the
|
jpayne@69
|
91 * same absolute addresses as in the first section.
|
jpayne@69
|
92 *
|
jpayne@69
|
93 * When the pointer to options is NULL, the default value (zero)
|
jpayne@69
|
94 * is used.
|
jpayne@69
|
95 */
|
jpayne@69
|
96 uint32_t start_offset;
|
jpayne@69
|
97
|
jpayne@69
|
98 } lzma_options_bcj;
|