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
125
126
127
128
129
130
131
132
#![allow(non_upper_case_globals, non_snake_case)]
pub enum LLVMOpaqueDisasmContext {}
pub type LLVMDisasmContextRef = *mut LLVMOpaqueDisasmContext;
pub type LLVMOpInfoCallback =
Option<extern "C" fn(DisInfo: *mut ::libc::c_void,
PC: u64, Offset: u64,
Size: u64,
TagType: ::libc::c_int,
TagBuf: *mut ::libc::c_void)
-> ::libc::c_int>;
#[repr(C)]
pub struct LLVMOpInfoSymbol1 {
pub Present: u64,
pub Name: *const ::libc::c_char,
pub Value: u64,
}
#[repr(C)]
pub struct Struct_LLVMOpInfo1 {
pub AddSymbol: LLVMOpInfoSymbol1,
pub SubtractSymbol: LLVMOpInfoSymbol1,
pub Value: u64,
pub VariantKind: u64,
}
pub const LLVMDisassembler_VariantKind_None: u64 = 0;
pub const LLVMDisassembler_VariantKind_ARM_HI16: u64 = 1;
pub const LLVMDisassembler_VariantKind_ARM_LO16: u64 = 2;
pub const LLVMDisassembler_VariantKind_ARM64_PAGE: u64 = 1;
pub const LLVMDisassembler_VariantKind_ARM64_PAGEOFF: u64 = 2;
pub const LLVMDisassembler_VariantKind_ARM64_GOTPAGE: u64 = 3;
pub const LLVMDisassembler_VariantKind_ARM64_GOTPAGEOFF: u64 = 4;
pub const LLVMDisassembler_VariantKind_ARM64_TLVP: u64 = 5;
pub const LLVMDisassembler_VariantKind_ARM64_TLVOFF: u64 = 6;
pub const LLVMDisassembler_ReferenceType_InOut_None: u64 = 0;
pub const LLVMDisassembler_ReferenceType_In_Branch: u64 = 1;
pub const LLVMDisassembler_ReferenceType_In_PCrel_Load: u64 = 2;
pub const LLVMDisassembler_ReferenceType_In_ARM64_ADRP: u64 = 0x100000001;
pub const LLVMDisassembler_ReferenceType_In_ARM64_ADDXri: u64 = 0x100000002;
pub const LLVMDisassembler_ReferenceType_In_ARM64_LDRXui: u64 = 0x100000003;
pub const LLVMDisassembler_ReferenceType_In_ARM64_LDRXl: u64 = 0x100000004;
pub const LLVMDisassembler_ReferenceType_In_ARM64_ADR: u64 = 0x100000005;
pub const LLVMDisassembler_ReferenceType_Out_SymbolStub: u64 = 1;
pub const LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr: u64 = 2;
pub const LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr: u64 = 3;
pub const LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref: u64 = 4;
pub const LLVMDisassembler_ReferenceType_Out_Objc_Message: u64 = 5;
pub const LLVMDisassembler_ReferenceType_Out_Objc_Message_Ref: u64 = 6;
pub const LLVMDisassembler_ReferenceType_Out_Objc_Selector_Ref: u64 = 7;
pub const LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref: u64 = 8;
pub const LLVMDisassembler_ReferenceType_DeMangled_Name: u64 = 9;
pub const LLVMDisassembler_Option_UseMarkup: u64 = 1;
pub const LLVMDisassembler_Option_PrintImmHex: u64 = 2;
pub const LLVMDisassembler_Option_AsmPrinterVariant: u64 = 4;
pub const LLVMDisassembler_Option_SetInstrComments: u64 = 8;
pub const LLVMDisassembler_Option_PrintLatency: u64 = 16;
pub type LLVMSymbolLookupCallback =
Option<extern "C" fn(DisInfo: *mut ::libc::c_void,
ReferenceValue: u64,
ReferenceType: *mut u64,
ReferencePC: u64,
ReferenceName:
*mut *const ::libc::c_char)
-> *const ::libc::c_char>;
extern "C" {
pub fn LLVMCreateDisasm(TripleName: *const ::libc::c_char,
DisInfo: *mut ::libc::c_void,
TagType: ::libc::c_int,
GetOpInfo: LLVMOpInfoCallback,
SymbolLookUp: LLVMSymbolLookupCallback)
-> LLVMDisasmContextRef;
pub fn LLVMCreateDisasmCPU(Triple: *const ::libc::c_char,
CPU: *const ::libc::c_char,
DisInfo: *mut ::libc::c_void,
TagType: ::libc::c_int,
GetOpInfo: LLVMOpInfoCallback,
SymbolLookUp: LLVMSymbolLookupCallback)
-> LLVMDisasmContextRef;
pub fn LLVMCreateDisasmCPUFeatures(Triple: *const ::libc::c_char,
CPU: *const ::libc::c_char,
Features: *const ::libc::c_char,
DisInfo: *mut ::libc::c_void,
TagType: ::libc::c_int,
GetOpInfo: LLVMOpInfoCallback,
SymbolLookUp: LLVMSymbolLookupCallback)
-> LLVMDisasmContextRef;
pub fn LLVMSetDisasmOptions(DC: LLVMDisasmContextRef, Options: u64)
-> ::libc::c_int;
pub fn LLVMDisasmDispose(DC: LLVMDisasmContextRef) -> ();
pub fn LLVMDisasmInstruction(DC: LLVMDisasmContextRef,
Bytes: *mut u8, BytesSize: u64,
PC: u64, OutString: *mut ::libc::c_char,
OutStringSize: ::libc::size_t) -> ::libc::size_t;
}