]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Bra.h
MdeModulePkg: strip trailing whitespace
[mirror_edk2.git] / MdeModulePkg / Library / LzmaCustomDecompressLib / Sdk / C / Bra.h
CommitLineData
11ff2c71 1/* Bra.h -- Branch converters for executables\r
1e230224 22013-01-18 : Igor Pavlov : Public domain */\r
11ff2c71
LG
3\r
4#ifndef __BRA_H\r
5#define __BRA_H\r
6\r
1e230224
LG
7#include "7zTypes.h"\r
8\r
9EXTERN_C_BEGIN\r
11ff2c71
LG
10\r
11/*\r
12These functions convert relative addresses to absolute addresses\r
13in CALL instructions to increase the compression ratio.\r
ba39402f 14\r
11ff2c71
LG
15 In:\r
16 data - data buffer\r
17 size - size of data\r
18 ip - current virtual Instruction Pinter (IP) value\r
19 state - state variable for x86 converter\r
20 encoding - 0 (for decoding), 1 (for encoding)\r
ba39402f 21\r
11ff2c71
LG
22 Out:\r
23 state - state variable for x86 converter\r
24\r
25 Returns:\r
26 The number of processed bytes. If you call these functions with multiple calls,\r
27 you must start next call with first byte after block of processed bytes.\r
ba39402f 28\r
11ff2c71 29 Type Endian Alignment LookAhead\r
ba39402f 30\r
11ff2c71
LG
31 x86 little 1 4\r
32 ARMT little 2 2\r
33 ARM little 4 0\r
34 PPC big 4 0\r
35 SPARC big 4 0\r
36 IA64 little 16 0\r
37\r
38 size must be >= Alignment + LookAhead, if it's not last block.\r
39 If (size < Alignment + LookAhead), converter returns 0.\r
40\r
41 Example:\r
42\r
43 UInt32 ip = 0;\r
44 for ()\r
45 {\r
46 ; size must be >= Alignment + LookAhead, if it's not last block\r
47 SizeT processed = Convert(data, size, ip, 1);\r
48 data += processed;\r
49 size -= processed;\r
50 ip += processed;\r
51 }\r
52*/\r
53\r
54#define x86_Convert_Init(state) { state = 0; }\r
55SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);\r
56SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);\r
57SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);\r
58SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);\r
59SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);\r
60SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);\r
61\r
1e230224
LG
62EXTERN_C_END\r
63\r
11ff2c71 64#endif\r