RetroArch
Bra.h
Go to the documentation of this file.
1 /* Bra.h -- Branch converters for executables
2  2009-02-07 : Igor Pavlov : Public domain */
3 
4 #ifndef __BRA_H
5 #define __BRA_H
6 
7 #include "7zTypes.h"
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13  /*
14  These functions convert relative addresses to absolute addresses
15  in CALL instructions to increase the compression ratio.
16 
17 In:
18 data - data buffer
19 size - size of data
20 ip - current virtual Instruction Pinter (IP) value
21 state - state variable for x86 converter
22 encoding - 0 (for decoding), 1 (for encoding)
23 
24 Out:
25 state - state variable for x86 converter
26 
27 Returns:
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.
30 
31 Type Endian Alignment LookAhead
32 
33 x86 little 1 4
34 ARMT little 2 2
35 ARM little 4 0
36 PPC big 4 0
37 SPARC big 4 0
38 IA64 little 16 0
39 
40 size must be >= Alignment + LookAhead, if it's not last block.
41 If (size < Alignment + LookAhead), converter returns 0.
42 
43 Example:
44 
45 uint32_t ip = 0;
46 for ()
47 {
48 ; size must be >= Alignment + LookAhead, if it's not last block
49 size_t processed = Convert(data, size, ip, 1);
50 data += processed;
51 size -= processed;
52 ip += processed;
53 }
54 */
55 
56 #define x86_Convert_Init(state) { state = 0; }
57 size_t x86_Convert(uint8_t *data, size_t size, uint32_t ip, uint32_t *state, int encoding);
58 size_t ARM_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding);
59 size_t ARMT_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding);
60 size_t PPC_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding);
61 size_t SPARC_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding);
62 size_t IA64_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif
size_t SPARC_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding)
Definition: Bra.c:100
size_t ARMT_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding)
Definition: Bra.c:34
JSON_Encoding encoding
Definition: jsonsax_full.h:274
size_t x86_Convert(uint8_t *data, size_t size, uint32_t ip, uint32_t *state, int encoding)
Definition: Bra86.c:12
GLsizeiptr size
Definition: glext.h:6559
Definition: ibxm.h:9
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
size_t ARM_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding)
Definition: Bra.c:7
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
size_t PPC_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding)
Definition: Bra.c:70
size_t IA64_Convert(uint8_t *data, size_t size, uint32_t ip, int encoding)