qemu_plugin_sys/
bindings_v5.rs

1/* automatically generated by rust-bindgen 0.72.0 */
2
3pub const QEMU_PLUGIN_VERSION: u32 = 5;
4#[repr(C)]
5#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
6pub struct GArray {
7    pub data: *mut ::std::os::raw::c_char,
8    pub len: ::std::os::raw::c_uint,
9}
10impl Default for GArray {
11    fn default() -> Self {
12        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13        unsafe {
14            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15            s.assume_init()
16        }
17    }
18}
19#[repr(C)]
20#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21pub struct GByteArray {
22    pub data: *mut ::std::os::raw::c_uchar,
23    pub len: ::std::os::raw::c_uint,
24}
25impl Default for GByteArray {
26    fn default() -> Self {
27        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
28        unsafe {
29            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
30            s.assume_init()
31        }
32    }
33}
34#[doc = " typedef qemu_plugin_id_t - Unique plugin ID"]
35pub type qemu_plugin_id_t = u64;
36#[doc = " struct qemu_info_t - system information for plugins\n\n This structure provides for some limited information about the\n system to allow the plugin to make decisions on how to proceed. For\n example it might only be suitable for running on some guest\n architectures or when under full system emulation."]
37#[repr(C)]
38#[derive(Copy, Clone)]
39pub struct qemu_info_t {
40    #[doc = " @target_name: string describing architecture"]
41    pub target_name: *const ::std::os::raw::c_char,
42    pub version: qemu_info_t__bindgen_ty_1,
43    #[doc = " @system_emulation: is this a full system emulation?"]
44    pub system_emulation: bool,
45    pub __bindgen_anon_1: qemu_info_t__bindgen_ty_2,
46}
47#[doc = " @version: minimum and current plugin API level"]
48#[repr(C)]
49#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
50pub struct qemu_info_t__bindgen_ty_1 {
51    pub min: ::std::os::raw::c_int,
52    pub cur: ::std::os::raw::c_int,
53}
54#[repr(C)]
55#[derive(Copy, Clone)]
56pub union qemu_info_t__bindgen_ty_2 {
57    pub system: qemu_info_t__bindgen_ty_2__bindgen_ty_1,
58}
59#[doc = " @system: information relevant to system emulation"]
60#[repr(C)]
61#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
62pub struct qemu_info_t__bindgen_ty_2__bindgen_ty_1 {
63    #[doc = " @system.smp_vcpus: initial number of vCPUs"]
64    pub smp_vcpus: ::std::os::raw::c_int,
65    #[doc = " @system.max_vcpus: maximum possible number of vCPUs"]
66    pub max_vcpus: ::std::os::raw::c_int,
67}
68impl Default for qemu_info_t__bindgen_ty_2 {
69    fn default() -> Self {
70        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
71        unsafe {
72            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
73            s.assume_init()
74        }
75    }
76}
77impl Default for qemu_info_t {
78    fn default() -> Self {
79        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
80        unsafe {
81            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
82            s.assume_init()
83        }
84    }
85}
86#[doc = " typedef qemu_plugin_simple_cb_t - simple callback\n @id: the unique qemu_plugin_id_t\n\n This callback passes no information aside from the unique @id."]
87pub type qemu_plugin_simple_cb_t =
88    ::std::option::Option<unsafe extern "C" fn(id: qemu_plugin_id_t)>;
89#[doc = " typedef qemu_plugin_udata_cb_t - callback with user data\n @id: the unique qemu_plugin_id_t\n @userdata: a pointer to some user data supplied when the callback\n was registered."]
90pub type qemu_plugin_udata_cb_t = ::std::option::Option<
91    unsafe extern "C" fn(id: qemu_plugin_id_t, userdata: *mut ::std::os::raw::c_void),
92>;
93#[doc = " typedef qemu_plugin_vcpu_simple_cb_t - vcpu callback\n @id: the unique qemu_plugin_id_t\n @vcpu_index: the current vcpu context"]
94pub type qemu_plugin_vcpu_simple_cb_t = ::std::option::Option<
95    unsafe extern "C" fn(id: qemu_plugin_id_t, vcpu_index: ::std::os::raw::c_uint),
96>;
97#[doc = " typedef qemu_plugin_vcpu_udata_cb_t - vcpu callback\n @vcpu_index: the current vcpu context\n @userdata: a pointer to some user data supplied when the callback\n was registered."]
98pub type qemu_plugin_vcpu_udata_cb_t = ::std::option::Option<
99    unsafe extern "C" fn(vcpu_index: ::std::os::raw::c_uint, userdata: *mut ::std::os::raw::c_void),
100>;
101unsafe extern "C" {
102    #[doc = " qemu_plugin_uninstall() - Uninstall a plugin\n @id: this plugin's opaque ID\n @cb: callback to be called once the plugin has been removed\n\n Do NOT assume that the plugin has been uninstalled once this function\n returns. Plugins are uninstalled asynchronously, and therefore the given\n plugin receives callbacks until @cb is called.\n\n Note: Calling this function from qemu_plugin_install() is a bug."]
103    pub fn qemu_plugin_uninstall(id: qemu_plugin_id_t, cb: qemu_plugin_simple_cb_t);
104}
105unsafe extern "C" {
106    #[doc = " qemu_plugin_reset() - Reset a plugin\n @id: this plugin's opaque ID\n @cb: callback to be called once the plugin has been reset\n\n Unregisters all callbacks for the plugin given by @id.\n\n Do NOT assume that the plugin has been reset once this function returns.\n Plugins are reset asynchronously, and therefore the given plugin receives\n callbacks until @cb is called."]
107    pub fn qemu_plugin_reset(id: qemu_plugin_id_t, cb: qemu_plugin_simple_cb_t);
108}
109unsafe extern "C" {
110    #[doc = " qemu_plugin_register_vcpu_init_cb() - register a vCPU initialization callback\n @id: plugin ID\n @cb: callback function\n\n The @cb function is called every time a vCPU is initialized.\n\n See also: qemu_plugin_register_vcpu_exit_cb()"]
111    pub fn qemu_plugin_register_vcpu_init_cb(
112        id: qemu_plugin_id_t,
113        cb: qemu_plugin_vcpu_simple_cb_t,
114    );
115}
116unsafe extern "C" {
117    #[doc = " qemu_plugin_register_vcpu_exit_cb() - register a vCPU exit callback\n @id: plugin ID\n @cb: callback function\n\n The @cb function is called every time a vCPU exits.\n\n See also: qemu_plugin_register_vcpu_init_cb()"]
118    pub fn qemu_plugin_register_vcpu_exit_cb(
119        id: qemu_plugin_id_t,
120        cb: qemu_plugin_vcpu_simple_cb_t,
121    );
122}
123unsafe extern "C" {
124    #[doc = " qemu_plugin_register_vcpu_idle_cb() - register a vCPU idle callback\n @id: plugin ID\n @cb: callback function\n\n The @cb function is called every time a vCPU idles."]
125    pub fn qemu_plugin_register_vcpu_idle_cb(
126        id: qemu_plugin_id_t,
127        cb: qemu_plugin_vcpu_simple_cb_t,
128    );
129}
130unsafe extern "C" {
131    #[doc = " qemu_plugin_register_vcpu_resume_cb() - register a vCPU resume callback\n @id: plugin ID\n @cb: callback function\n\n The @cb function is called every time a vCPU resumes execution."]
132    pub fn qemu_plugin_register_vcpu_resume_cb(
133        id: qemu_plugin_id_t,
134        cb: qemu_plugin_vcpu_simple_cb_t,
135    );
136}
137#[doc = " struct qemu_plugin_tb - Opaque handle for a translation block"]
138#[repr(C)]
139#[derive(Debug, Copy, Clone)]
140pub struct qemu_plugin_tb {
141    _unused: [u8; 0],
142}
143#[doc = " struct qemu_plugin_insn - Opaque handle for a translated instruction"]
144#[repr(C)]
145#[derive(Debug, Copy, Clone)]
146pub struct qemu_plugin_insn {
147    _unused: [u8; 0],
148}
149#[doc = " struct qemu_plugin_scoreboard - Opaque handle for a scoreboard"]
150#[repr(C)]
151#[derive(Debug, Copy, Clone)]
152pub struct qemu_plugin_scoreboard {
153    _unused: [u8; 0],
154}
155#[doc = " typedef qemu_plugin_u64 - uint64_t member of an entry in a scoreboard\n\n This field allows to access a specific uint64_t member in one given entry,\n located at a specified offset. Inline operations expect this as entry."]
156#[repr(C)]
157#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
158pub struct qemu_plugin_u64 {
159    pub score: *mut qemu_plugin_scoreboard,
160    pub offset: usize,
161}
162impl Default for qemu_plugin_u64 {
163    fn default() -> Self {
164        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
165        unsafe {
166            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
167            s.assume_init()
168        }
169    }
170}
171#[repr(u32)]
172#[doc = " enum qemu_plugin_cb_flags - type of callback\n\n @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs\n @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs\n @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs"]
173#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
174pub enum qemu_plugin_cb_flags {
175    QEMU_PLUGIN_CB_NO_REGS = 0,
176    QEMU_PLUGIN_CB_R_REGS = 1,
177    QEMU_PLUGIN_CB_RW_REGS = 2,
178}
179#[repr(u32)]
180#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
181pub enum qemu_plugin_mem_rw {
182    QEMU_PLUGIN_MEM_R = 1,
183    QEMU_PLUGIN_MEM_W = 2,
184    QEMU_PLUGIN_MEM_RW = 3,
185}
186#[repr(u32)]
187#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
188pub enum qemu_plugin_mem_value_type {
189    QEMU_PLUGIN_MEM_VALUE_U8 = 0,
190    QEMU_PLUGIN_MEM_VALUE_U16 = 1,
191    QEMU_PLUGIN_MEM_VALUE_U32 = 2,
192    QEMU_PLUGIN_MEM_VALUE_U64 = 3,
193    QEMU_PLUGIN_MEM_VALUE_U128 = 4,
194}
195#[doc = " typedef qemu_plugin_mem_value - value accessed during a load/store"]
196#[repr(C)]
197#[derive(Copy, Clone)]
198pub struct qemu_plugin_mem_value {
199    pub type_: qemu_plugin_mem_value_type,
200    pub data: qemu_plugin_mem_value__bindgen_ty_1,
201}
202#[repr(C)]
203#[derive(Copy, Clone)]
204pub union qemu_plugin_mem_value__bindgen_ty_1 {
205    pub u8_: u8,
206    pub u16_: u16,
207    pub u32_: u32,
208    pub u64_: u64,
209    pub u128_: qemu_plugin_mem_value__bindgen_ty_1__bindgen_ty_1,
210}
211#[repr(C)]
212#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
213pub struct qemu_plugin_mem_value__bindgen_ty_1__bindgen_ty_1 {
214    pub low: u64,
215    pub high: u64,
216}
217impl Default for qemu_plugin_mem_value__bindgen_ty_1 {
218    fn default() -> Self {
219        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
220        unsafe {
221            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
222            s.assume_init()
223        }
224    }
225}
226impl Default for qemu_plugin_mem_value {
227    fn default() -> Self {
228        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
229        unsafe {
230            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
231            s.assume_init()
232        }
233    }
234}
235#[repr(u32)]
236#[doc = " enum qemu_plugin_cond - condition to enable callback\n\n @QEMU_PLUGIN_COND_NEVER: false\n @QEMU_PLUGIN_COND_ALWAYS: true\n @QEMU_PLUGIN_COND_EQ: is equal?\n @QEMU_PLUGIN_COND_NE: is not equal?\n @QEMU_PLUGIN_COND_LT: is less than?\n @QEMU_PLUGIN_COND_LE: is less than or equal?\n @QEMU_PLUGIN_COND_GT: is greater than?\n @QEMU_PLUGIN_COND_GE: is greater than or equal?"]
237#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
238pub enum qemu_plugin_cond {
239    QEMU_PLUGIN_COND_NEVER = 0,
240    QEMU_PLUGIN_COND_ALWAYS = 1,
241    QEMU_PLUGIN_COND_EQ = 2,
242    QEMU_PLUGIN_COND_NE = 3,
243    QEMU_PLUGIN_COND_LT = 4,
244    QEMU_PLUGIN_COND_LE = 5,
245    QEMU_PLUGIN_COND_GT = 6,
246    QEMU_PLUGIN_COND_GE = 7,
247}
248#[doc = " typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback\n @id: unique plugin id\n @tb: opaque handle used for querying and instrumenting a block."]
249pub type qemu_plugin_vcpu_tb_trans_cb_t =
250    ::std::option::Option<unsafe extern "C" fn(id: qemu_plugin_id_t, tb: *mut qemu_plugin_tb)>;
251unsafe extern "C" {
252    #[doc = " qemu_plugin_register_vcpu_tb_trans_cb() - register a translate cb\n @id: plugin ID\n @cb: callback function\n\n The @cb function is called every time a translation occurs. The @cb\n function is passed an opaque qemu_plugin_type which it can query\n for additional information including the list of translated\n instructions. At this point the plugin can register further\n callbacks to be triggered when the block or individual instruction\n executes."]
253    pub fn qemu_plugin_register_vcpu_tb_trans_cb(
254        id: qemu_plugin_id_t,
255        cb: qemu_plugin_vcpu_tb_trans_cb_t,
256    );
257}
258unsafe extern "C" {
259    #[doc = " qemu_plugin_register_vcpu_tb_exec_cb() - register execution callback\n @tb: the opaque qemu_plugin_tb handle for the translation\n @cb: callback function\n @flags: does the plugin read or write the CPU's registers?\n @userdata: any plugin data to pass to the @cb?\n\n The @cb function is called every time a translated unit executes."]
260    pub fn qemu_plugin_register_vcpu_tb_exec_cb(
261        tb: *mut qemu_plugin_tb,
262        cb: qemu_plugin_vcpu_udata_cb_t,
263        flags: qemu_plugin_cb_flags,
264        userdata: *mut ::std::os::raw::c_void,
265    );
266}
267unsafe extern "C" {
268    #[doc = " qemu_plugin_register_vcpu_tb_exec_cond_cb() - register conditional callback\n @tb: the opaque qemu_plugin_tb handle for the translation\n @cb: callback function\n @cond: condition to enable callback\n @entry: first operand for condition\n @imm: second operand for condition\n @flags: does the plugin read or write the CPU's registers?\n @userdata: any plugin data to pass to the @cb?\n\n The @cb function is called when a translated unit executes if\n entry @cond imm is true.\n If condition is QEMU_PLUGIN_COND_ALWAYS, condition is never interpreted and\n this function is equivalent to qemu_plugin_register_vcpu_tb_exec_cb.\n If condition QEMU_PLUGIN_COND_NEVER, condition is never interpreted and\n callback is never installed."]
269    pub fn qemu_plugin_register_vcpu_tb_exec_cond_cb(
270        tb: *mut qemu_plugin_tb,
271        cb: qemu_plugin_vcpu_udata_cb_t,
272        flags: qemu_plugin_cb_flags,
273        cond: qemu_plugin_cond,
274        entry: qemu_plugin_u64,
275        imm: u64,
276        userdata: *mut ::std::os::raw::c_void,
277    );
278}
279#[repr(u32)]
280#[doc = " enum qemu_plugin_op - describes an inline op\n\n @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t\n @QEMU_PLUGIN_INLINE_STORE_U64: store an immediate value uint64_t"]
281#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
282pub enum qemu_plugin_op {
283    QEMU_PLUGIN_INLINE_ADD_U64 = 0,
284    QEMU_PLUGIN_INLINE_STORE_U64 = 1,
285}
286unsafe extern "C" {
287    #[doc = " qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu() - execution inline op\n @tb: the opaque qemu_plugin_tb handle for the translation\n @op: the type of qemu_plugin_op (e.g. ADD_U64)\n @entry: entry to run op\n @imm: the op data (e.g. 1)\n\n Insert an inline op on a given scoreboard entry."]
288    pub fn qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu(
289        tb: *mut qemu_plugin_tb,
290        op: qemu_plugin_op,
291        entry: qemu_plugin_u64,
292        imm: u64,
293    );
294}
295unsafe extern "C" {
296    #[doc = " qemu_plugin_register_vcpu_insn_exec_cb() - register insn execution cb\n @insn: the opaque qemu_plugin_insn handle for an instruction\n @cb: callback function\n @flags: does the plugin read or write the CPU's registers?\n @userdata: any plugin data to pass to the @cb?\n\n The @cb function is called every time an instruction is executed"]
297    pub fn qemu_plugin_register_vcpu_insn_exec_cb(
298        insn: *mut qemu_plugin_insn,
299        cb: qemu_plugin_vcpu_udata_cb_t,
300        flags: qemu_plugin_cb_flags,
301        userdata: *mut ::std::os::raw::c_void,
302    );
303}
304unsafe extern "C" {
305    #[doc = " qemu_plugin_register_vcpu_insn_exec_cond_cb() - conditional insn execution cb\n @insn: the opaque qemu_plugin_insn handle for an instruction\n @cb: callback function\n @flags: does the plugin read or write the CPU's registers?\n @cond: condition to enable callback\n @entry: first operand for condition\n @imm: second operand for condition\n @userdata: any plugin data to pass to the @cb?\n\n The @cb function is called when an instruction executes if\n entry @cond imm is true.\n If condition is QEMU_PLUGIN_COND_ALWAYS, condition is never interpreted and\n this function is equivalent to qemu_plugin_register_vcpu_insn_exec_cb.\n If condition QEMU_PLUGIN_COND_NEVER, condition is never interpreted and\n callback is never installed."]
306    pub fn qemu_plugin_register_vcpu_insn_exec_cond_cb(
307        insn: *mut qemu_plugin_insn,
308        cb: qemu_plugin_vcpu_udata_cb_t,
309        flags: qemu_plugin_cb_flags,
310        cond: qemu_plugin_cond,
311        entry: qemu_plugin_u64,
312        imm: u64,
313        userdata: *mut ::std::os::raw::c_void,
314    );
315}
316unsafe extern "C" {
317    #[doc = " qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inline op\n @insn: the opaque qemu_plugin_insn handle for an instruction\n @op: the type of qemu_plugin_op (e.g. ADD_U64)\n @entry: entry to run op\n @imm: the op data (e.g. 1)\n\n Insert an inline op to every time an instruction executes."]
318    pub fn qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(
319        insn: *mut qemu_plugin_insn,
320        op: qemu_plugin_op,
321        entry: qemu_plugin_u64,
322        imm: u64,
323    );
324}
325unsafe extern "C" {
326    #[doc = " qemu_plugin_tb_n_insns() - query helper for number of insns in TB\n @tb: opaque handle to TB passed to callback\n\n Returns: number of instructions in this block"]
327    pub fn qemu_plugin_tb_n_insns(tb: *const qemu_plugin_tb) -> usize;
328}
329unsafe extern "C" {
330    #[doc = " qemu_plugin_tb_vaddr() - query helper for vaddr of TB start\n @tb: opaque handle to TB passed to callback\n\n Returns: virtual address of block start"]
331    pub fn qemu_plugin_tb_vaddr(tb: *const qemu_plugin_tb) -> u64;
332}
333unsafe extern "C" {
334    #[doc = " qemu_plugin_tb_get_insn() - retrieve handle for instruction\n @tb: opaque handle to TB passed to callback\n @idx: instruction number, 0 indexed\n\n The returned handle can be used in follow up helper queries as well\n as when instrumenting an instruction. It is only valid for the\n lifetime of the callback.\n\n Returns: opaque handle to instruction"]
335    pub fn qemu_plugin_tb_get_insn(tb: *const qemu_plugin_tb, idx: usize) -> *mut qemu_plugin_insn;
336}
337unsafe extern "C" {
338    #[doc = " qemu_plugin_insn_data() - copy instruction data\n @insn: opaque instruction handle from qemu_plugin_tb_get_insn()\n @dest: destination into which data is copied\n @len: length of dest\n\n Returns the number of bytes copied, minimum of @len and insn size."]
339    pub fn qemu_plugin_insn_data(
340        insn: *const qemu_plugin_insn,
341        dest: *mut ::std::os::raw::c_void,
342        len: usize,
343    ) -> usize;
344}
345unsafe extern "C" {
346    #[doc = " qemu_plugin_insn_size() - return size of instruction\n @insn: opaque instruction handle from qemu_plugin_tb_get_insn()\n\n Returns: size of instruction in bytes"]
347    pub fn qemu_plugin_insn_size(insn: *const qemu_plugin_insn) -> usize;
348}
349unsafe extern "C" {
350    #[doc = " qemu_plugin_insn_vaddr() - return vaddr of instruction\n @insn: opaque instruction handle from qemu_plugin_tb_get_insn()\n\n Returns: virtual address of instruction"]
351    pub fn qemu_plugin_insn_vaddr(insn: *const qemu_plugin_insn) -> u64;
352}
353unsafe extern "C" {
354    #[doc = " qemu_plugin_insn_haddr() - return hardware addr of instruction\n @insn: opaque instruction handle from qemu_plugin_tb_get_insn()\n\n Returns: hardware (physical) target address of instruction"]
355    pub fn qemu_plugin_insn_haddr(insn: *const qemu_plugin_insn) -> *mut ::std::os::raw::c_void;
356}
357#[doc = " typedef qemu_plugin_meminfo_t - opaque memory transaction handle\n\n This can be further queried using the qemu_plugin_mem_* query\n functions."]
358pub type qemu_plugin_meminfo_t = u32;
359#[doc = " struct qemu_plugin_hwaddr - opaque hw address handle"]
360#[repr(C)]
361#[derive(Debug, Copy, Clone)]
362pub struct qemu_plugin_hwaddr {
363    _unused: [u8; 0],
364}
365unsafe extern "C" {
366    #[doc = " qemu_plugin_mem_size_shift() - get size of access\n @info: opaque memory transaction handle\n\n Returns: size of access in ^2 (0=byte, 1=16bit, 2=32bit etc...)"]
367    pub fn qemu_plugin_mem_size_shift(info: qemu_plugin_meminfo_t) -> ::std::os::raw::c_uint;
368}
369unsafe extern "C" {
370    #[doc = " qemu_plugin_mem_is_sign_extended() - was the access sign extended\n @info: opaque memory transaction handle\n\n Returns: true if it was, otherwise false"]
371    pub fn qemu_plugin_mem_is_sign_extended(info: qemu_plugin_meminfo_t) -> bool;
372}
373unsafe extern "C" {
374    #[doc = " qemu_plugin_mem_is_big_endian() - was the access big endian\n @info: opaque memory transaction handle\n\n Returns: true if it was, otherwise false"]
375    pub fn qemu_plugin_mem_is_big_endian(info: qemu_plugin_meminfo_t) -> bool;
376}
377unsafe extern "C" {
378    #[doc = " qemu_plugin_mem_is_store() - was the access a store\n @info: opaque memory transaction handle\n\n Returns: true if it was, otherwise false"]
379    pub fn qemu_plugin_mem_is_store(info: qemu_plugin_meminfo_t) -> bool;
380}
381unsafe extern "C" {
382    #[doc = " qemu_plugin_mem_get_value() - return last value loaded/stored\n @info: opaque memory transaction handle\n\n Returns: memory value"]
383    pub fn qemu_plugin_mem_get_value(info: qemu_plugin_meminfo_t) -> qemu_plugin_mem_value;
384}
385unsafe extern "C" {
386    #[doc = " qemu_plugin_get_hwaddr() - return handle for memory operation\n @info: opaque memory info structure\n @vaddr: the virtual address of the memory operation\n\n For system emulation returns a qemu_plugin_hwaddr handle to query\n details about the actual physical address backing the virtual\n address. For linux-user guests it just returns NULL.\n\n This handle is *only* valid for the duration of the callback. Any\n information about the handle should be recovered before the\n callback returns."]
387    pub fn qemu_plugin_get_hwaddr(
388        info: qemu_plugin_meminfo_t,
389        vaddr: u64,
390    ) -> *mut qemu_plugin_hwaddr;
391}
392unsafe extern "C" {
393    #[doc = " qemu_plugin_hwaddr_is_io() - query whether memory operation is IO\n @haddr: address handle from qemu_plugin_get_hwaddr()\n\n Returns true if the handle's memory operation is to memory-mapped IO, or\n false if it is to RAM"]
394    pub fn qemu_plugin_hwaddr_is_io(haddr: *const qemu_plugin_hwaddr) -> bool;
395}
396unsafe extern "C" {
397    #[doc = " qemu_plugin_hwaddr_phys_addr() - query physical address for memory operation\n @haddr: address handle from qemu_plugin_get_hwaddr()\n\n Returns the physical address associated with the memory operation\n\n Note that the returned physical address may not be unique if you are dealing\n with multiple address spaces."]
398    pub fn qemu_plugin_hwaddr_phys_addr(haddr: *const qemu_plugin_hwaddr) -> u64;
399}
400unsafe extern "C" {
401    #[doc = " Returns a string representing the device. The string is valid for\n the lifetime of the plugin."]
402    pub fn qemu_plugin_hwaddr_device_name(
403        h: *const qemu_plugin_hwaddr,
404    ) -> *const ::std::os::raw::c_char;
405}
406#[doc = " typedef qemu_plugin_vcpu_mem_cb_t - memory callback function type\n @vcpu_index: the executing vCPU\n @info: an opaque handle for further queries about the memory\n @vaddr: the virtual address of the transaction\n @userdata: any user data attached to the callback"]
407pub type qemu_plugin_vcpu_mem_cb_t = ::std::option::Option<
408    unsafe extern "C" fn(
409        vcpu_index: ::std::os::raw::c_uint,
410        info: qemu_plugin_meminfo_t,
411        vaddr: u64,
412        userdata: *mut ::std::os::raw::c_void,
413    ),
414>;
415unsafe extern "C" {
416    #[doc = " qemu_plugin_register_vcpu_mem_cb() - register memory access callback\n @insn: handle for instruction to instrument\n @cb: callback of type qemu_plugin_vcpu_mem_cb_t\n @flags: (currently unused) callback flags\n @rw: monitor reads, writes or both\n @userdata: opaque pointer for userdata\n\n This registers a full callback for every memory access generated by\n an instruction. If the instruction doesn't access memory no\n callback will be made.\n\n The callback reports the vCPU the access took place on, the virtual\n address of the access and a handle for further queries. The user\n can attach some userdata to the callback for additional purposes.\n\n Other execution threads will continue to execute during the\n callback so the plugin is responsible for ensuring it doesn't get\n confused by making appropriate use of locking if required."]
417    pub fn qemu_plugin_register_vcpu_mem_cb(
418        insn: *mut qemu_plugin_insn,
419        cb: qemu_plugin_vcpu_mem_cb_t,
420        flags: qemu_plugin_cb_flags,
421        rw: qemu_plugin_mem_rw,
422        userdata: *mut ::std::os::raw::c_void,
423    );
424}
425unsafe extern "C" {
426    #[doc = " qemu_plugin_register_vcpu_mem_inline_per_vcpu() - inline op for mem access\n @insn: handle for instruction to instrument\n @rw: apply to reads, writes or both\n @op: the op, of type qemu_plugin_op\n @entry: entry to run op\n @imm: immediate data for @op\n\n This registers a inline op every memory access generated by the\n instruction."]
427    pub fn qemu_plugin_register_vcpu_mem_inline_per_vcpu(
428        insn: *mut qemu_plugin_insn,
429        rw: qemu_plugin_mem_rw,
430        op: qemu_plugin_op,
431        entry: qemu_plugin_u64,
432        imm: u64,
433    );
434}
435unsafe extern "C" {
436    #[doc = " qemu_plugin_request_time_control() - request the ability to control time\n\n This grants the plugin the ability to control system time. Only one\n plugin can control time so if multiple plugins request the ability\n all but the first will fail.\n\n Returns an opaque handle or NULL if fails"]
437    pub fn qemu_plugin_request_time_control() -> *const ::std::os::raw::c_void;
438}
439unsafe extern "C" {
440    #[doc = " qemu_plugin_update_ns() - update system emulation time\n @handle: opaque handle returned by qemu_plugin_request_time_control()\n @time: time in nanoseconds\n\n This allows an appropriately authorised plugin (i.e. holding the\n time control handle) to move system time forward to @time. For\n user-mode emulation the time is not changed by this as all reported\n time comes from the host kernel.\n\n Start time is 0."]
441    pub fn qemu_plugin_update_ns(handle: *const ::std::os::raw::c_void, time: i64);
442}
443pub type qemu_plugin_vcpu_syscall_cb_t = ::std::option::Option<
444    unsafe extern "C" fn(
445        id: qemu_plugin_id_t,
446        vcpu_index: ::std::os::raw::c_uint,
447        num: i64,
448        a1: u64,
449        a2: u64,
450        a3: u64,
451        a4: u64,
452        a5: u64,
453        a6: u64,
454        a7: u64,
455        a8: u64,
456    ),
457>;
458unsafe extern "C" {
459    pub fn qemu_plugin_register_vcpu_syscall_cb(
460        id: qemu_plugin_id_t,
461        cb: qemu_plugin_vcpu_syscall_cb_t,
462    );
463}
464pub type qemu_plugin_vcpu_syscall_ret_cb_t = ::std::option::Option<
465    unsafe extern "C" fn(
466        id: qemu_plugin_id_t,
467        vcpu_idx: ::std::os::raw::c_uint,
468        num: i64,
469        ret: i64,
470    ),
471>;
472unsafe extern "C" {
473    pub fn qemu_plugin_register_vcpu_syscall_ret_cb(
474        id: qemu_plugin_id_t,
475        cb: qemu_plugin_vcpu_syscall_ret_cb_t,
476    );
477}
478unsafe extern "C" {
479    #[doc = " qemu_plugin_insn_disas() - return disassembly string for instruction\n @insn: instruction reference\n\n Returns an allocated string containing the disassembly"]
480    pub fn qemu_plugin_insn_disas(insn: *const qemu_plugin_insn) -> *mut ::std::os::raw::c_char;
481}
482unsafe extern "C" {
483    #[doc = " qemu_plugin_insn_symbol() - best effort symbol lookup\n @insn: instruction reference\n\n Return a static string referring to the symbol. This is dependent\n on the binary QEMU is running having provided a symbol table."]
484    pub fn qemu_plugin_insn_symbol(insn: *const qemu_plugin_insn) -> *const ::std::os::raw::c_char;
485}
486unsafe extern "C" {
487    #[doc = " qemu_plugin_vcpu_for_each() - iterate over the existing vCPU\n @id: plugin ID\n @cb: callback function\n\n The @cb function is called once for each existing vCPU.\n\n See also: qemu_plugin_register_vcpu_init_cb()"]
488    pub fn qemu_plugin_vcpu_for_each(id: qemu_plugin_id_t, cb: qemu_plugin_vcpu_simple_cb_t);
489}
490unsafe extern "C" {
491    pub fn qemu_plugin_register_flush_cb(id: qemu_plugin_id_t, cb: qemu_plugin_simple_cb_t);
492}
493unsafe extern "C" {
494    #[doc = " qemu_plugin_register_atexit_cb() - register exit callback\n @id: plugin ID\n @cb: callback\n @userdata: user data for callback\n\n The @cb function is called once execution has finished. Plugins\n should be able to free all their resources at this point much like\n after a reset/uninstall callback is called.\n\n In user-mode it is possible a few un-instrumented instructions from\n child threads may run before the host kernel reaps the threads."]
495    pub fn qemu_plugin_register_atexit_cb(
496        id: qemu_plugin_id_t,
497        cb: qemu_plugin_udata_cb_t,
498        userdata: *mut ::std::os::raw::c_void,
499    );
500}
501unsafe extern "C" {
502    #[doc = " returns how many vcpus were started at this point"]
503    pub fn qemu_plugin_num_vcpus() -> ::std::os::raw::c_int;
504}
505unsafe extern "C" {
506    #[doc = " qemu_plugin_outs() - output string via QEMU's logging system\n @string: a string"]
507    pub fn qemu_plugin_outs(string: *const ::std::os::raw::c_char);
508}
509unsafe extern "C" {
510    #[doc = " qemu_plugin_bool_parse() - parses a boolean argument in the form of\n \"<argname>=[on|yes|true|off|no|false]\"\n\n @name: argument name, the part before the equals sign\n @val: argument value, what's after the equals sign\n @ret: output return value\n\n returns true if the combination @name=@val parses correctly to a boolean\n argument, and false otherwise"]
511    pub fn qemu_plugin_bool_parse(
512        name: *const ::std::os::raw::c_char,
513        val: *const ::std::os::raw::c_char,
514        ret: *mut bool,
515    ) -> bool;
516}
517unsafe extern "C" {
518    #[doc = " qemu_plugin_path_to_binary() - path to binary file being executed\n\n Return a string representing the path to the binary. For user-mode\n this is the main executable. For system emulation we currently\n return NULL. The user should g_free() the string once no longer\n needed."]
519    pub fn qemu_plugin_path_to_binary() -> *const ::std::os::raw::c_char;
520}
521unsafe extern "C" {
522    #[doc = " qemu_plugin_start_code() - returns start of text segment\n\n Returns the nominal start address of the main text segment in\n user-mode. Currently returns 0 for system emulation."]
523    pub fn qemu_plugin_start_code() -> u64;
524}
525unsafe extern "C" {
526    #[doc = " qemu_plugin_end_code() - returns end of text segment\n\n Returns the nominal end address of the main text segment in\n user-mode. Currently returns 0 for system emulation."]
527    pub fn qemu_plugin_end_code() -> u64;
528}
529unsafe extern "C" {
530    #[doc = " qemu_plugin_entry_code() - returns start address for module\n\n Returns the nominal entry address of the main text segment in\n user-mode. Currently returns 0 for system emulation."]
531    pub fn qemu_plugin_entry_code() -> u64;
532}
533#[doc = " struct qemu_plugin_register - Opaque handle for register access"]
534#[repr(C)]
535#[derive(Debug, Copy, Clone)]
536pub struct qemu_plugin_register {
537    _unused: [u8; 0],
538}
539#[doc = " typedef qemu_plugin_reg_descriptor - register descriptions\n\n @handle: opaque handle for retrieving value with qemu_plugin_read_register or\n          writing value with qemu_plugin_write_register\n @name: register name\n @feature: optional feature descriptor, can be NULL"]
540#[repr(C)]
541#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
542pub struct qemu_plugin_reg_descriptor {
543    pub handle: *mut qemu_plugin_register,
544    pub name: *const ::std::os::raw::c_char,
545    pub feature: *const ::std::os::raw::c_char,
546}
547impl Default for qemu_plugin_reg_descriptor {
548    fn default() -> Self {
549        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
550        unsafe {
551            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
552            s.assume_init()
553        }
554    }
555}
556unsafe extern "C" {
557    #[doc = " qemu_plugin_get_registers() - return register list for current vCPU\n\n Returns a potentially empty GArray of qemu_plugin_reg_descriptor.\n Caller frees the array (but not the const strings).\n\n Should be used from a qemu_plugin_register_vcpu_init_cb() callback\n after the vCPU is initialised, i.e. in the vCPU context."]
558    pub fn qemu_plugin_get_registers() -> *mut GArray;
559}
560unsafe extern "C" {
561    #[doc = " qemu_plugin_read_register() - read register for current vCPU\n\n @handle: a @qemu_plugin_reg_handle handle\n @buf: A GByteArray for the data owned by the plugin\n\n This function is only available in a context that register read access is\n explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag, if called inside a\n callback that can be registered with a qemu_plugin_cb_flags argument. This\n function can also be used in any callback context that does not use a flags\n argument, such as in a callback registered with\n qemu_plugin_register_vcpu_init_cb(), except for callbacks registered with\n qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb().\n\n Returns the size of the read register. The content of @buf is in target byte\n order. On failure returns -1."]
562    pub fn qemu_plugin_read_register(
563        handle: *mut qemu_plugin_register,
564        buf: *mut GByteArray,
565    ) -> ::std::os::raw::c_int;
566}
567unsafe extern "C" {
568    #[doc = " qemu_plugin_write_register() - write register for current vCPU\n\n @handle: a @qemu_plugin_reg_handle handle\n @buf: A GByteArray for the data owned by the plugin\n\n This function is only available in a context that register read access is\n explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag, if called inside a\n callback that can be registered with a qemu_plugin_cb_flags argument. This\n function can also be used in any callback context that does not use a flags\n argument, such as in a callback registered with\n qemu_plugin_register_vcpu_init_cb(), except for callbacks registered with\n qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb().\n\n The size of @buf must be at least the size of the requested register.\n Attempting to write a register with @buf smaller than the register size\n will result in a crash or other undesired behavior.\n\n Returns the number of bytes written. On failure returns 0."]
569    pub fn qemu_plugin_write_register(
570        handle: *mut qemu_plugin_register,
571        buf: *mut GByteArray,
572    ) -> ::std::os::raw::c_int;
573}
574unsafe extern "C" {
575    #[doc = " qemu_plugin_read_memory_vaddr() - read from memory using a virtual address\n\n @addr: A virtual address to read from\n @data: A byte array to store data into\n @len: The number of bytes to read, starting from @addr\n\n @len bytes of data is read starting at @addr and stored into @data. If @data\n is not large enough to hold @len bytes, it will be expanded to the necessary\n size, reallocating if necessary. @len must be greater than 0.\n\n This function does not ensure writes are flushed prior to reading, so\n callers should take care when calling this function in plugin callbacks to\n avoid attempting to read data which may not yet be written and should use\n the memory callback API instead.\n\n Returns true on success and false on failure."]
576    pub fn qemu_plugin_read_memory_vaddr(addr: u64, data: *mut GByteArray, len: usize) -> bool;
577}
578unsafe extern "C" {
579    #[doc = " qemu_plugin_write_memory_vaddr() - write to memory using a virtual address\n\n @addr: A virtual address to write to\n @data: A byte array containing the data to write\n\n The contents of @data will be written to memory starting at the virtual\n address @addr.\n\n This function does not guarantee consistency of writes, nor does it ensure\n that pending writes are flushed either before or after the write takes place,\n so callers should take care to only call this function in vCPU context (i.e.\n in callbacks) and avoid depending on the existence of data written using this\n function which may be overwritten afterward.\n\n Returns true on success and false on failure."]
580    pub fn qemu_plugin_write_memory_vaddr(addr: u64, data: *mut GByteArray) -> bool;
581}
582#[repr(u32)]
583#[doc = " enum qemu_plugin_hwaddr_operation_result - result of a memory operation\n\n @QEMU_PLUGIN_HWADDR_OPERATION_OK: hwaddr operation succeeded\n @QEMU_PLUGIN_HWADDR_OPERATION_ERROR: unexpected error occurred\n @QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR: error in memory device\n @QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED: permission error\n @QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS: address was invalid\n @QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE: invalid address space"]
584#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
585pub enum qemu_plugin_hwaddr_operation_result {
586    QEMU_PLUGIN_HWADDR_OPERATION_OK = 0,
587    QEMU_PLUGIN_HWADDR_OPERATION_ERROR = 1,
588    QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR = 2,
589    QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED = 3,
590    QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS = 4,
591    QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE = 5,
592}
593unsafe extern "C" {
594    #[doc = " qemu_plugin_read_memory_hwaddr() - read from memory using a hardware address\n\n @addr: The physical address to read from\n @data: A byte array to store data into\n @len: The number of bytes to read, starting from @addr\n\n @len bytes of data is read from the current memory space for the current\n vCPU starting at @addr and stored into @data. If @data is not large enough to\n hold @len bytes, it will be expanded to the necessary size, reallocating if\n necessary. @len must be greater than 0.\n\n This function does not ensure writes are flushed prior to reading, so\n callers should take care when calling this function in plugin callbacks to\n avoid attempting to read data which may not yet be written and should use\n the memory callback API instead.\n\n This function is only valid for softmmu targets.\n\n Returns a qemu_plugin_hwaddr_operation_result indicating the result of the\n operation."]
595    pub fn qemu_plugin_read_memory_hwaddr(
596        addr: u64,
597        data: *mut GByteArray,
598        len: usize,
599    ) -> qemu_plugin_hwaddr_operation_result;
600}
601unsafe extern "C" {
602    #[doc = " qemu_plugin_write_memory_hwaddr() - write to memory using a hardware address\n\n @addr: A physical address to write to\n @data: A byte array containing the data to write\n\n The contents of @data will be written to memory starting at the hardware\n address @addr in the current address space for the current vCPU.\n\n This function does not guarantee consistency of writes, nor does it ensure\n that pending writes are flushed either before or after the write takes place,\n so callers should take care when calling this function in plugin callbacks to\n avoid depending on the existence of data written using this function which\n may be overwritten afterward. In addition, this function requires that the\n pages containing the address are not locked. Practically, this means that you\n should not write instruction memory in a current translation block inside a\n callback registered with qemu_plugin_register_vcpu_tb_trans_cb.\n\n You can, for example, write instruction memory in a current translation block\n in a callback registered with qemu_plugin_register_vcpu_tb_exec_cb, although\n be aware that the write will not be flushed until after the translation block\n has finished executing.  In general, this function should be used to write\n data memory or to patch code at a known address, not in a current translation\n block.\n\n This function is only valid for softmmu targets.\n\n Returns a qemu_plugin_hwaddr_operation_result indicating the result of the\n operation."]
603    pub fn qemu_plugin_write_memory_hwaddr(
604        addr: u64,
605        data: *mut GByteArray,
606    ) -> qemu_plugin_hwaddr_operation_result;
607}
608unsafe extern "C" {
609    #[doc = " qemu_plugin_translate_vaddr() - translate virtual address for current vCPU\n\n @vaddr: virtual address to translate\n @hwaddr: pointer to store the physical address\n\n This function is only valid in vCPU context (i.e. in callbacks) and is only\n valid for softmmu targets.\n\n Returns true on success and false on failure."]
610    pub fn qemu_plugin_translate_vaddr(vaddr: u64, hwaddr: *mut u64) -> bool;
611}
612unsafe extern "C" {
613    #[doc = " qemu_plugin_scoreboard_new() - alloc a new scoreboard\n\n @element_size: size (in bytes) for one entry\n\n Returns a pointer to a new scoreboard. It must be freed using\n qemu_plugin_scoreboard_free."]
614    pub fn qemu_plugin_scoreboard_new(element_size: usize) -> *mut qemu_plugin_scoreboard;
615}
616unsafe extern "C" {
617    #[doc = " qemu_plugin_scoreboard_free() - free a scoreboard\n @score: scoreboard to free"]
618    pub fn qemu_plugin_scoreboard_free(score: *mut qemu_plugin_scoreboard);
619}
620unsafe extern "C" {
621    #[doc = " qemu_plugin_scoreboard_find() - get pointer to an entry of a scoreboard\n @score: scoreboard to query\n @vcpu_index: entry index\n\n Returns address of entry of a scoreboard matching a given vcpu_index. This\n address can be modified later if scoreboard is resized."]
622    pub fn qemu_plugin_scoreboard_find(
623        score: *mut qemu_plugin_scoreboard,
624        vcpu_index: ::std::os::raw::c_uint,
625    ) -> *mut ::std::os::raw::c_void;
626}
627unsafe extern "C" {
628    #[doc = " qemu_plugin_u64_add() - add a value to a qemu_plugin_u64 for a given vcpu\n @entry: entry to query\n @vcpu_index: entry index\n @added: value to add"]
629    pub fn qemu_plugin_u64_add(
630        entry: qemu_plugin_u64,
631        vcpu_index: ::std::os::raw::c_uint,
632        added: u64,
633    );
634}
635unsafe extern "C" {
636    #[doc = " qemu_plugin_u64_get() - get value of a qemu_plugin_u64 for a given vcpu\n @entry: entry to query\n @vcpu_index: entry index"]
637    pub fn qemu_plugin_u64_get(entry: qemu_plugin_u64, vcpu_index: ::std::os::raw::c_uint) -> u64;
638}
639unsafe extern "C" {
640    #[doc = " qemu_plugin_u64_set() - set value of a qemu_plugin_u64 for a given vcpu\n @entry: entry to query\n @vcpu_index: entry index\n @val: new value"]
641    pub fn qemu_plugin_u64_set(
642        entry: qemu_plugin_u64,
643        vcpu_index: ::std::os::raw::c_uint,
644        val: u64,
645    );
646}
647unsafe extern "C" {
648    #[doc = " qemu_plugin_u64_sum() - return sum of all vcpu entries in a scoreboard\n @entry: entry to sum"]
649    pub fn qemu_plugin_u64_sum(entry: qemu_plugin_u64) -> u64;
650}