baryl 0.0.3

Public SDK for Baryl, a full-system emulation and introspection engine
/* automatically generated by rust-bindgen 0.72.1 */

use crate::abi::ProgressFn;

pub const BARYL_ENGINE_MAGIC: u64 = 7816404390861889546;
pub const BARYL_ENGINE_ABI_VERSION: u32 = 7;
pub const BARYL_ENGINE_MIN_ABI_VERSION: u32 = 7;
pub const BARYL_CAP_JIT: u32 = 1;
pub const BARYL_CAP_INTERP: u32 = 2;
pub const BARYL_CAP_COVERAGE: u32 = 4;
pub const BARYL_CAP_BREAKPOINTS: u32 = 8;
pub const BARYL_CAP_ICOUNT: u32 = 16;
pub const BARYL_CAP_NET: u32 = 32;
pub const GUEST_PACKET_RING_SLOTS: u32 = 64;
pub const GUEST_PACKET_MAX_LEN: u32 = 1518;
pub const BARYL_FW_BIOS: u32 = 0;
pub const BARYL_FW_UEFI: u32 = 1;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct EngRef {
    pub ctx: *mut ::core::ffi::c_void,
    pub vtable: *const EngineVtable,
}
impl Default for EngRef {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GuestPacketSlot {
    pub len: u16,
    pub bytes: [u8; 1518usize],
}
impl Default for GuestPacketSlot {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GuestPacketRing {
    pub prod: u32,
    pub cons: u32,
    pub dropped: u64,
    pub slots: [GuestPacketSlot; 64usize],
}
impl Default for GuestPacketRing {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct EngNetDescriptor {
    pub version: u32,
    pub rx: *mut GuestPacketRing,
    pub tx: *mut GuestPacketRing,
}
impl Default for EngNetDescriptor {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct EngMount {
    pub host: *const ::core::ffi::c_char,
    pub guest: *const ::core::ffi::c_char,
}
impl Default for EngMount {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct EngBootSpec {
    pub version: u32,
    pub argv: *const *const ::core::ffi::c_char,
    pub argc: u32,
    pub envp: *const *const ::core::ffi::c_char,
    pub envc: u32,
    pub mounts: *const EngMount,
    pub nmounts: u32,
}
impl Default for EngBootSpec {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct EngineVtable {
    pub phys_to_host_translate: ::core::option::Option<
        unsafe extern "C" fn(eng: EngRef, pa: u64, out_len: *mut u64) -> *mut u8,
    >,
    pub phys_read_into: ::core::option::Option<
        unsafe extern "C" fn(eng: EngRef, pa: u64, buf: *mut u8, len: u64) -> ::core::ffi::c_int,
    >,
    pub phys_write_from: ::core::option::Option<
        unsafe extern "C" fn(eng: EngRef, pa: u64, buf: *const u8, len: u64) -> ::core::ffi::c_int,
    >,
    pub phys_scan_for_pattern: ::core::option::Option<
        unsafe extern "C" fn(
            eng: EngRef,
            start: u64,
            end: u64,
            stride: u64,
            pat: *const u8,
            pat_len: u64,
            obj: *mut ::core::ffi::c_void,
            progress: ProgressFn,
        ) -> u64,
    >,
    pub phys_scan_for_u64: ::core::option::Option<
        unsafe extern "C" fn(
            eng: EngRef,
            start: u64,
            end: u64,
            stride: u64,
            target: u64,
            obj: *mut ::core::ffi::c_void,
            progress: ProgressFn,
        ) -> u64,
    >,
    pub phys_scan_for_u32: ::core::option::Option<
        unsafe extern "C" fn(
            eng: EngRef,
            start: u64,
            end: u64,
            stride: u64,
            target: u32,
            obj: *mut ::core::ffi::c_void,
            progress: ProgressFn,
        ) -> u64,
    >,
    pub jit_flush_page: ::core::option::Option<unsafe extern "C" fn(eng: EngRef, pa: u64)>,
    pub icount: ::core::option::Option<unsafe extern "C" fn(eng: EngRef) -> u64>,
    pub clamp_icount_budget:
        ::core::option::Option<unsafe extern "C" fn(eng: EngRef, max: u64) -> u64>,
    pub guest_mac: ::core::option::Option<
        unsafe extern "C" fn(eng: EngRef, out: *mut u8) -> ::core::ffi::c_int,
    >,
}