TianoCore EDK2
master
Loading...
Searching...
No Matches
Bra.h
1
/* Bra.h -- Branch converters for executables
2
2013-01-18 : Igor Pavlov : Public domain */
3
4
#ifndef __BRA_H
5
#define __BRA_H
6
7
#include "7zTypes.h"
8
9
EXTERN_C_BEGIN
10
11
/*
12
These functions convert relative addresses to absolute addresses
13
in CALL instructions to increase the compression ratio.
14
15
In:
16
data - data buffer
17
size - size of data
18
ip - current virtual Instruction Pinter (IP) value
19
state - state variable for x86 converter
20
encoding - 0 (for decoding), 1 (for encoding)
21
22
Out:
23
state - state variable for x86 converter
24
25
Returns:
26
The number of processed bytes. If you call these functions with multiple calls,
27
you must start next call with first byte after block of processed bytes.
28
29
Type Endian Alignment LookAhead
30
31
x86 little 1 4
32
ARMT little 2 2
33
ARM little 4 0
34
PPC big 4 0
35
SPARC big 4 0
36
IA64 little 16 0
37
38
size must be >= Alignment + LookAhead, if it's not last block.
39
If (size < Alignment + LookAhead), converter returns 0.
40
41
Example:
42
43
UInt32 ip = 0;
44
for ()
45
{
46
; size must be >= Alignment + LookAhead, if it's not last block
47
SizeT processed = Convert(data, size, ip, 1);
48
data += processed;
49
size -= processed;
50
ip += processed;
51
}
52
*/
53
54
#define x86_Convert_Init(state) { state = 0; }
55
SizeT
56
x86_Convert (
57
Byte *data,
58
SizeT size,
59
UInt32 ip,
60
UInt32 *state,
61
int
encoding
62
);
63
64
SizeT
65
ARM_Convert (
66
Byte *data,
67
SizeT size,
68
UInt32 ip,
69
int
encoding
70
);
71
72
SizeT
73
ARMT_Convert (
74
Byte *data,
75
SizeT size,
76
UInt32 ip,
77
int
encoding
78
);
79
80
SizeT
81
PPC_Convert (
82
Byte *data,
83
SizeT size,
84
UInt32 ip,
85
int
encoding
86
);
87
88
SizeT
89
SPARC_Convert (
90
Byte *data,
91
SizeT size,
92
UInt32 ip,
93
int
encoding
94
);
95
96
SizeT
97
IA64_Convert (
98
Byte *data,
99
SizeT size,
100
UInt32 ip,
101
int
encoding
102
);
103
104
EXTERN_C_END
105
106
#endif
MdeModulePkg
Library
LzmaCustomDecompressLib
Sdk
C
Bra.h
Generated on Fri Nov 15 2024 18:01:11 for TianoCore EDK2 by
1.9.6