1207753Smm/**
2207753Smm * \file        lzma/bcj.h
3207753Smm * \brief       Branch/Call/Jump conversion filters
4207753Smm */
5207753Smm
6207753Smm/*
7207753Smm * Author: Lasse Collin
8207753Smm *
9207753Smm * This file has been put into the public domain.
10207753Smm * You can do whatever you want with this file.
11207753Smm *
12207753Smm * See ../lzma.h for information about liblzma as a whole.
13207753Smm */
14207753Smm
15207753Smm#ifndef LZMA_H_INTERNAL
16207753Smm#	error Never include this file directly. Use <lzma.h> instead.
17207753Smm#endif
18207753Smm
19207753Smm
20207753Smm/* Filter IDs for lzma_filter.id */
21207753Smm
22207753Smm#define LZMA_FILTER_X86         LZMA_VLI_C(0x04)
23207753Smm	/**<
24207753Smm	 * Filter for x86 binaries
25207753Smm	 */
26207753Smm
27207753Smm#define LZMA_FILTER_POWERPC     LZMA_VLI_C(0x05)
28207753Smm	/**<
29207753Smm	 * Filter for Big endian PowerPC binaries
30207753Smm	 */
31207753Smm
32207753Smm#define LZMA_FILTER_IA64        LZMA_VLI_C(0x06)
33207753Smm	/**<
34215187Smm	 * Filter for IA-64 (Itanium) binaries.
35207753Smm	 */
36207753Smm
37207753Smm#define LZMA_FILTER_ARM         LZMA_VLI_C(0x07)
38207753Smm	/**<
39207753Smm	 * Filter for ARM binaries.
40207753Smm	 */
41207753Smm
42207753Smm#define LZMA_FILTER_ARMTHUMB    LZMA_VLI_C(0x08)
43207753Smm	/**<
44215187Smm	 * Filter for ARM-Thumb binaries.
45207753Smm	 */
46207753Smm
47207753Smm#define LZMA_FILTER_SPARC       LZMA_VLI_C(0x09)
48207753Smm	/**<
49207753Smm	 * Filter for SPARC binaries.
50207753Smm	 */
51207753Smm
52207753Smm
53207753Smm/**
54207753Smm * \brief       Options for BCJ filters
55207753Smm *
56207753Smm * The BCJ filters never change the size of the data. Specifying options
57207753Smm * for them is optional: if pointer to options is NULL, default value is
58207753Smm * used. You probably never need to specify options to BCJ filters, so just
59207753Smm * set the options pointer to NULL and be happy.
60207753Smm *
61207753Smm * If options with non-default values have been specified when encoding,
62207753Smm * the same options must also be specified when decoding.
63207753Smm *
64207753Smm * \note        At the moment, none of the BCJ filters support
65207753Smm *              LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified,
66207753Smm *              LZMA_OPTIONS_ERROR will be returned. If there is need,
67207753Smm *              partial support for LZMA_SYNC_FLUSH can be added in future.
68207753Smm *              Partial means that flushing would be possible only at
69207753Smm *              offsets that are multiple of 2, 4, or 16 depending on
70207753Smm *              the filter, except x86 which cannot be made to support
71207753Smm *              LZMA_SYNC_FLUSH predictably.
72207753Smm */
73207753Smmtypedef struct {
74207753Smm	/**
75207753Smm	 * \brief       Start offset for conversions
76207753Smm	 *
77207753Smm	 * This setting is useful only when the same filter is used
78207753Smm	 * _separately_ for multiple sections of the same executable file,
79207753Smm	 * and the sections contain cross-section branch/call/jump
80207753Smm	 * instructions. In that case it is beneficial to set the start
81207753Smm	 * offset of the non-first sections so that the relative addresses
82207753Smm	 * of the cross-section branch/call/jump instructions will use the
83207753Smm	 * same absolute addresses as in the first section.
84207753Smm	 *
85207753Smm	 * When the pointer to options is NULL, the default value (zero)
86207753Smm	 * is used.
87207753Smm	 */
88207753Smm	uint32_t start_offset;
89207753Smm
90207753Smm} lzma_options_bcj;
91