Skip to content

Commit

Permalink
[mm] Add find_free_area function for mmap syscalls
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-stars committed Sep 18, 2024
1 parent 55f33cd commit 81f8e83
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/axmm/src/aspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ impl AddrSpace {
Ok(())
}

/// Finds a free area that can accommodate the given size.

/// The search starts from the given hint address, and the area should be within the given limit range.

/// Returns the start address of the free area. Returns None if no such area is found.
pub fn find_free_area(
&self,
hint: VirtAddr,
size: usize,
limit: VirtAddrRange,
) -> Option<VirtAddr> {
self.areas.find_free_area(hint, size, limit)
}

/// Add a new linear mapping.
///
/// See [`Backend`] for more details about the mapping backends.
Expand Down

0 comments on commit 81f8e83

Please sign in to comment.