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