This repository has been archived by the owner on Apr 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCFG.proto
124 lines (103 loc) · 3.84 KB
/
CFG.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
message OffsetTable {
required int64 start_addr = 1;
repeated int64 table_offsets = 2;
repeated int64 destinations = 3;
}
message JumpTbl {
repeated int64 table_entries = 1;
required int32 zero_offset = 2;
optional int64 offset_from_data = 3;
}
message JumpIndexTbl {
required bytes table_entries = 1;
required int32 zero_offset = 2;
}
message Instruction {
enum RefType {
CodeRef = 0;
DataRef = 1;
}
required bytes inst_bytes = 1;
required int64 inst_addr = 2;
optional int64 true_target = 3;
optional int64 false_target = 4;
required int32 inst_len = 5;
optional int64 imm_reference = 6;
optional int64 imm_reloc_offset = 15;
optional RefType imm_ref_type = 16;
optional int64 mem_reference = 8;
optional int64 mem_reloc_offset = 9;
optional RefType mem_ref_type = 18;
//optional int64 call_target = 8;
optional string ext_call_name = 7;
//optional int32 reloc_offset = 9;
optional JumpTbl jump_table = 10;
optional JumpIndexTbl jump_index_table = 11;
optional string ext_data_name = 12;
optional int32 system_call_number = 13;
optional bool local_noreturn = 14;
optional int64 offset_table_addr = 19;
}
message Block {
repeated Instruction insts = 1;
required int64 base_address = 2;
//the block_follows list is used to rebuild the basic block CFG, so it
//should contain the list of base_addresses for blocks following this
//block in the CFG
repeated int64 block_follows = 3;
}
message Function {
repeated Block blocks = 1;
required int64 entry_address = 2;
optional string symbol_name = 3;
}
message ExternalFunction {
enum CallingConvention {
CallerCleanup = 0;
CalleeCleanup = 1;
FastCall = 2;
McsemaCall = 3;
}
required string symbol_name = 1;
required CallingConvention calling_convention = 2;
required bool has_return = 3;
required bool no_return = 4;
required int32 argument_count = 5;
required bool is_weak = 6;
optional string signature = 7;
}
message ExternalData {
required string symbol_name = 1;
required int32 data_size = 2;
required bool is_weak = 3;
}
message DataSymbol {
required int64 base_address = 1;
required string symbol_name = 2;
required int32 symbol_size = 3;
}
message Data {
required int64 base_address = 1;
required bytes data = 2;
repeated DataSymbol symbols = 3;
required bool read_only = 4;
}
message EntrySymbolExtra {
required int32 entry_argc = 1;
required ExternalFunction.CallingConvention entry_cconv = 2;
required bool does_return = 3;
}
message EntrySymbol {
required string entry_name = 1;
required int64 entry_address = 2;
optional EntrySymbolExtra entry_extra = 3;
}
message Module {
repeated Function internal_funcs = 1;
repeated ExternalFunction external_funcs = 2;
repeated Data internal_data = 3;
required string module_name = 4;
repeated EntrySymbol entries = 5;
repeated ExternalData external_data = 6;
repeated OffsetTable offset_tables = 7;
}