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