Function region::query_range

source ·
pub fn query_range(address: *const u8, size: usize) -> Result<Vec<Region>>
Expand description

Queries the OS with a range, returning the regions it contains.

A 2-byte range straddling a page boundary will return both pages (or one region, if the pages have the same properties). The implementation uses query internally.

  • The range is [address, address + size)
  • The address is rounded down to the closest page boundary.
  • The address may not be null.
  • The size may not be zero.

Examples

let data = [0; 100];
let region = region::query_range(data.as_ptr(), data.len()).unwrap();

assert!(region.len() > 0);