Skip to content

Commit

Permalink
feat: Add ctl_context_mode to rust bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
mlgiraud committed Aug 16, 2023
1 parent fd3b708 commit fbe1b44
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bindings/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

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(
&self,
t: TlbType,
Expand Down
11 changes: 11 additions & 0 deletions bindings/rust/src/unicorn_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,21 @@ pub enum ControlType {
UC_CTL_TB_FLUSH = 10,
UC_CTL_TLB_FLUSH = 11,
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_WRITE = 1 << 30,
}

bitflags! {
#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub struct ContextMode : u32 {
const CPU = 1;
const Memory = 2;
}
}

#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct TlbEntry {
Expand Down

0 comments on commit fbe1b44

Please sign in to comment.