| 1 | /* Bra.h -- Branch converters for executables |
| 2 | 2008-10-04 : Igor Pavlov : Public domain */ |
| 3 | |
| 4 | #ifndef __BRA_H |
| 5 | #define __BRA_Hcxx . . $ `compression/lzma/Bra.h:5:9`! |
| 6 | |
| 7 | #include "Types.h"cxx . . $ `<file>/compression/lzma/Types.h`/ |
| 8 | |
| 9 | /* |
| 10 | These functions convert relative addresses to absolute addresses |
| 11 | in CALL instructions to increase the compression ratio. |
| 12 | |
| 13 | In: |
| 14 | data - data buffer |
| 15 | size - size of data |
| 16 | ip - current virtual Instruction Pinter (IP) value |
| 17 | state - state variable for x86 converter |
| 18 | encoding - 0 (for decoding), 1 (for encoding) |
| 19 | |
| 20 | Out: |
| 21 | state - state variable for x86 converter |
| 22 | |
| 23 | Returns: |
| 24 | The number of processed bytes. If you call these functions with multiple calls, |
| 25 | you must start next call with first byte after block of processed bytes. |
| 26 | |
| 27 | Type Endian Alignment LookAhead |
| 28 | |
| 29 | x86 little 1 4 |
| 30 | ARMT little 2 2 |
| 31 | ARM little 4 0 |
| 32 | PPC big 4 0 |
| 33 | SPARC big 4 0 |
| 34 | IA64 little 16 0 |
| 35 | |
| 36 | size must be >= Alignment + LookAhead, if it's not last block. |
| 37 | If (size < Alignment + LookAhead), converter returns 0. |
| 38 | |
| 39 | Example: |
| 40 | |
| 41 | UInt32 ip = 0; |
| 42 | for () |
| 43 | { |
| 44 | ; size must be >= Alignment + LookAhead, if it's not last block |
| 45 | SizeT processed = Convert(data, size, ip, 1); |
| 46 | data += processed; |
| 47 | size -= processed; |
| 48 | ip += processed; |
| 49 | } |
| 50 | */ |
| 51 | |
| 52 | #define x86_Convert_Initcxx . . $ `compression/lzma/Bra.h:52:9`!(state) { state = 0; } |
| 53 | SizeTcxx . . $ SizeT# x86_Convertcxx . . $ x86_Convert(5125666cce7acd55).(Bytecxx . . $ Byte# *data, SizeTcxx . . $ SizeT# size, UInt32cxx . . $ UInt32# ip, UInt32cxx . . $ UInt32# *state, int encoding); |
| 54 | SizeTcxx . . $ SizeT# ARM_Convertcxx . . $ ARM_Convert(b70ad5692b3c5ef9).(Bytecxx . . $ Byte# *data, SizeTcxx . . $ SizeT# size, UInt32cxx . . $ UInt32# ip, int encoding); |
| 55 | SizeTcxx . . $ SizeT# ARMT_Convertcxx . . $ ARMT_Convert(b70ad5692b3c5ef9).(Bytecxx . . $ Byte# *data, SizeTcxx . . $ SizeT# size, UInt32cxx . . $ UInt32# ip, int encoding); |
| 56 | SizeTcxx . . $ SizeT# PPC_Convertcxx . . $ PPC_Convert(b70ad5692b3c5ef9).(Bytecxx . . $ Byte# *data, SizeTcxx . . $ SizeT# size, UInt32cxx . . $ UInt32# ip, int encoding); |
| 57 | SizeTcxx . . $ SizeT# SPARC_Convertcxx . . $ SPARC_Convert(b70ad5692b3c5ef9).(Bytecxx . . $ Byte# *data, SizeTcxx . . $ SizeT# size, UInt32cxx . . $ UInt32# ip, int encoding); |
| 58 | SizeTcxx . . $ SizeT# IA64_Convertcxx . . $ IA64_Convert(b70ad5692b3c5ef9).(Bytecxx . . $ Byte# *data, SizeTcxx . . $ SizeT# size, UInt32cxx . . $ UInt32# ip, int encoding); |
| 59 | |
| 60 | #endif |