1 /* Bra.h -- Branch converters for executables
2 2009-02-07 : Igor Pavlov : Public domain */
14 These functions convert relative addresses to absolute addresses
15 in CALL instructions to increase the compression ratio.
20 ip - current virtual Instruction Pinter (IP) value
21 state - state variable for x86 converter
22 encoding - 0 (for decoding), 1 (for encoding)
25 state - state variable for x86 converter
28 The number of processed bytes. If you call these functions with multiple calls,
29 you must start next call with first byte after block of processed bytes.
31 Type Endian Alignment LookAhead
40 size must be >= Alignment + LookAhead, if it's not last block.
41 If (size < Alignment + LookAhead), converter returns 0.
48 ; size must be >= Alignment + LookAhead, if it's not last block
49 SizeT processed = Convert(data, size, ip, 1);
56 #define x86_Convert_Init(state) { state = 0; }
57 SizeT
x86_Convert(Byte
*data
, SizeT size
, UInt32 ip
, UInt32
*state
, int encoding
);
58 SizeT
ARM_Convert(Byte
*data
, SizeT size
, UInt32 ip
, int encoding
);
59 SizeT
ARMT_Convert(Byte
*data
, SizeT size
, UInt32 ip
, int encoding
);
60 SizeT
PPC_Convert(Byte
*data
, SizeT size
, UInt32 ip
, int encoding
);
61 SizeT
SPARC_Convert(Byte
*data
, SizeT size
, UInt32 ip
, int encoding
);
62 SizeT
IA64_Convert(Byte
*data
, SizeT size
, UInt32 ip
, int encoding
);