vmm: Add page size as a parameter for MemoryRangeTable::from_bitmap()

This will be helpful to support the creation of a MemoryRangeTable from
virtio-mem, as it uses 2M pages.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2021-09-23 09:54:40 +02:00
committed by Bo Chen
parent af3a59aa33
commit a1caa6549a
3 changed files with 3 additions and 4 deletions

View File

@@ -184,8 +184,7 @@ pub struct MemoryRangeTable {
}
impl MemoryRangeTable {
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64) -> Self {
let page_size = 4096;
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64, page_size: u64) -> Self {
let mut table = MemoryRangeTable::default();
let mut entry: Option<MemoryRange> = None;
for (i, block) in bitmap.iter().enumerate() {