Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/arch/x86_64/kernel/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ fn check_linux_args(
linux_mmio: &'static [String],
) -> Vec<(VolatileRef<'static, DeviceRegisters>, u8)> {
let layout = PageLayout::from_size(BasePageSize::SIZE as usize).unwrap();
let page_range = PageBox::new(layout).unwrap();
let virtual_address = VirtAddr::from(page_range.start());
let mut page_range = PageBox::new(layout).unwrap();
let mut virtual_address = VirtAddr::from(page_range.start());

let mut devices = vec![];
for arg in linux_mmio {
Expand Down Expand Up @@ -138,6 +138,12 @@ fn check_linux_args(
FrameAlloc::allocate_at(frame_range).unwrap_err();
}

// Don't return the VA to the free list: the driver holds a VolatileRef into this mapping.
PageBox::into_raw(page_range);
// Pick a fresh VA for subsequent iterations.
page_range = PageBox::new(layout).unwrap();
virtual_address = VirtAddr::from(page_range.start());

devices.push((mmio, irq));
}
_ => {
Expand Down
Loading