bcj.h 2.7 KB

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