xref: /dflybsd-src/contrib/xz/src/liblzma/api/lzma/bcj.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /**
286d7f5d3SJohn Marino  * \file        lzma/bcj.h
386d7f5d3SJohn Marino  * \brief       Branch/Call/Jump conversion filters
486d7f5d3SJohn Marino  */
586d7f5d3SJohn Marino 
686d7f5d3SJohn Marino /*
786d7f5d3SJohn Marino  * Author: Lasse Collin
886d7f5d3SJohn Marino  *
986d7f5d3SJohn Marino  * This file has been put into the public domain.
1086d7f5d3SJohn Marino  * You can do whatever you want with this file.
1186d7f5d3SJohn Marino  *
1286d7f5d3SJohn Marino  * See ../lzma.h for information about liblzma as a whole.
1386d7f5d3SJohn Marino  */
1486d7f5d3SJohn Marino 
1586d7f5d3SJohn Marino #ifndef LZMA_H_INTERNAL
1686d7f5d3SJohn Marino #	error Never include this file directly. Use <lzma.h> instead.
1786d7f5d3SJohn Marino #endif
1886d7f5d3SJohn Marino 
1986d7f5d3SJohn Marino 
2086d7f5d3SJohn Marino /* Filter IDs for lzma_filter.id */
2186d7f5d3SJohn Marino 
2286d7f5d3SJohn Marino #define LZMA_FILTER_X86         LZMA_VLI_C(0x04)
2386d7f5d3SJohn Marino 	/**<
2486d7f5d3SJohn Marino 	 * Filter for x86 binaries
2586d7f5d3SJohn Marino 	 */
2686d7f5d3SJohn Marino 
2786d7f5d3SJohn Marino #define LZMA_FILTER_POWERPC     LZMA_VLI_C(0x05)
2886d7f5d3SJohn Marino 	/**<
2986d7f5d3SJohn Marino 	 * Filter for Big endian PowerPC binaries
3086d7f5d3SJohn Marino 	 */
3186d7f5d3SJohn Marino 
3286d7f5d3SJohn Marino #define LZMA_FILTER_IA64        LZMA_VLI_C(0x06)
3386d7f5d3SJohn Marino 	/**<
3486d7f5d3SJohn Marino 	 * Filter for IA-64 (Itanium) binaries.
3586d7f5d3SJohn Marino 	 */
3686d7f5d3SJohn Marino 
3786d7f5d3SJohn Marino #define LZMA_FILTER_ARM         LZMA_VLI_C(0x07)
3886d7f5d3SJohn Marino 	/**<
3986d7f5d3SJohn Marino 	 * Filter for ARM binaries.
4086d7f5d3SJohn Marino 	 */
4186d7f5d3SJohn Marino 
4286d7f5d3SJohn Marino #define LZMA_FILTER_ARMTHUMB    LZMA_VLI_C(0x08)
4386d7f5d3SJohn Marino 	/**<
4486d7f5d3SJohn Marino 	 * Filter for ARM-Thumb binaries.
4586d7f5d3SJohn Marino 	 */
4686d7f5d3SJohn Marino 
4786d7f5d3SJohn Marino #define LZMA_FILTER_SPARC       LZMA_VLI_C(0x09)
4886d7f5d3SJohn Marino 	/**<
4986d7f5d3SJohn Marino 	 * Filter for SPARC binaries.
5086d7f5d3SJohn Marino 	 */
5186d7f5d3SJohn Marino 
5286d7f5d3SJohn Marino 
5386d7f5d3SJohn Marino /**
5486d7f5d3SJohn Marino  * \brief       Options for BCJ filters
5586d7f5d3SJohn Marino  *
5686d7f5d3SJohn Marino  * The BCJ filters never change the size of the data. Specifying options
5786d7f5d3SJohn Marino  * for them is optional: if pointer to options is NULL, default value is
5886d7f5d3SJohn Marino  * used. You probably never need to specify options to BCJ filters, so just
5986d7f5d3SJohn Marino  * set the options pointer to NULL and be happy.
6086d7f5d3SJohn Marino  *
6186d7f5d3SJohn Marino  * If options with non-default values have been specified when encoding,
6286d7f5d3SJohn Marino  * the same options must also be specified when decoding.
6386d7f5d3SJohn Marino  *
6486d7f5d3SJohn Marino  * \note        At the moment, none of the BCJ filters support
6586d7f5d3SJohn Marino  *              LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified,
6686d7f5d3SJohn Marino  *              LZMA_OPTIONS_ERROR will be returned. If there is need,
6786d7f5d3SJohn Marino  *              partial support for LZMA_SYNC_FLUSH can be added in future.
6886d7f5d3SJohn Marino  *              Partial means that flushing would be possible only at
6986d7f5d3SJohn Marino  *              offsets that are multiple of 2, 4, or 16 depending on
7086d7f5d3SJohn Marino  *              the filter, except x86 which cannot be made to support
7186d7f5d3SJohn Marino  *              LZMA_SYNC_FLUSH predictably.
7286d7f5d3SJohn Marino  */
7386d7f5d3SJohn Marino typedef struct {
7486d7f5d3SJohn Marino 	/**
7586d7f5d3SJohn Marino 	 * \brief       Start offset for conversions
7686d7f5d3SJohn Marino 	 *
7786d7f5d3SJohn Marino 	 * This setting is useful only when the same filter is used
7886d7f5d3SJohn Marino 	 * _separately_ for multiple sections of the same executable file,
7986d7f5d3SJohn Marino 	 * and the sections contain cross-section branch/call/jump
8086d7f5d3SJohn Marino 	 * instructions. In that case it is beneficial to set the start
8186d7f5d3SJohn Marino 	 * offset of the non-first sections so that the relative addresses
8286d7f5d3SJohn Marino 	 * of the cross-section branch/call/jump instructions will use the
8386d7f5d3SJohn Marino 	 * same absolute addresses as in the first section.
8486d7f5d3SJohn Marino 	 *
8586d7f5d3SJohn Marino 	 * When the pointer to options is NULL, the default value (zero)
8686d7f5d3SJohn Marino 	 * is used.
8786d7f5d3SJohn Marino 	 */
8886d7f5d3SJohn Marino 	uint32_t start_offset;
8986d7f5d3SJohn Marino 
9086d7f5d3SJohn Marino } lzma_options_bcj;
91