Merge pull request #1872 from mlgiraud/feat/uc_ctl_context_mode

Add uc_ctl_context_mode to rust bindings
This commit is contained in:
2023-08-17 12:09:04 +08:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

@@ -1139,6 +1139,13 @@ impl<'a, D> Unicorn<'a, D> {
unsafe { ffi::uc_ctl(self.get_handle(), UC_CTL_WRITE!(ControlType::UC_CTL_TLB_FLUSH)) }.into() unsafe { ffi::uc_ctl(self.get_handle(), UC_CTL_WRITE!(ControlType::UC_CTL_TLB_FLUSH)) }.into()
} }
pub fn ctl_context_mode(
&self,
mode: ContextMode,
) -> Result<(), uc_error> {
unsafe { ffi::uc_ctl(self.get_handle(), UC_CTL_WRITE!(ControlType::UC_CTL_CONTEXT_MODE), mode) }.into()
}
pub fn ctl_tlb_type( pub fn ctl_tlb_type(
&self, &self,
t: TlbType, t: TlbType,

View File

@@ -281,10 +281,21 @@ pub enum ControlType {
UC_CTL_TB_FLUSH = 10, UC_CTL_TB_FLUSH = 10,
UC_CTL_TLB_FLUSH = 11, UC_CTL_TLB_FLUSH = 11,
UC_CTL_TLB_TYPE = 12, UC_CTL_TLB_TYPE = 12,
UC_CTL_TCG_BUFFER_SIZE = 13,
UC_CTL_CONTEXT_MODE = 14,
UC_CTL_IO_READ = 1 << 31, UC_CTL_IO_READ = 1 << 31,
UC_CTL_IO_WRITE = 1 << 30, UC_CTL_IO_WRITE = 1 << 30,
} }
bitflags! {
#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub struct ContextMode : u32 {
const CPU = 1;
const Memory = 2;
}
}
#[repr(C)] #[repr(C)]
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct TlbEntry { pub struct TlbEntry {