summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-07-29 19:24:24 -0400
committerJosh Ferrell <josh@vector35.com>2025-07-29 19:24:24 -0400
commit6a03627644b4593c701c93c7cf30a8f4490f84e8 (patch)
tree3bdc18800e67bd48c59fb5ddfb695c8fb7a4758b /rust/src
parent5244be17ac0b2c600cc95c70ec33bde568986d90 (diff)
Add MemoryMap::add_unbacked_memory_region to rust api
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/binary_view/memory_map.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/rust/src/binary_view/memory_map.rs b/rust/src/binary_view/memory_map.rs
index cedea26e..914c3aee 100644
--- a/rust/src/binary_view/memory_map.rs
+++ b/rust/src/binary_view/memory_map.rs
@@ -114,6 +114,28 @@ impl MemoryMap {
}
}
+ /// Adds an unbacked memory region with a given length and fill byte.
+ pub fn add_unbacked_memory_region(
+ &mut self,
+ name: &str,
+ start: u64,
+ length: u64,
+ segment_flags: Option<SegmentFlags>,
+ fill: Option<u8>,
+ ) -> bool {
+ let name_raw = name.to_cstr();
+ unsafe {
+ BNAddUnbackedMemoryRegion(
+ self.view.handle,
+ name_raw.as_ptr(),
+ start,
+ length,
+ segment_flags.unwrap_or_default().into_raw(),
+ fill.unwrap_or_default(),
+ )
+ }
+ }
+
pub fn remove_memory_region(&mut self, name: &str) -> bool {
let name_raw = name.to_cstr();
unsafe { BNRemoveMemoryRegion(self.view.handle, name_raw.as_ptr()) }