WIP: improve speed of Grant::map_inactive

Use recursive page table address to calculate p4 entry
parent 8fcbf152
......@@ -9,7 +9,7 @@ use memory::allocate_frames;
use super::entry::{EntryFlags, Entry};
use super::ENTRY_COUNT;
pub const P4: *mut Table<Level4> = 0xffff_ffff_ffff_f000 as *mut _;
pub const P4: *mut Table<Level4> = (::RECURSIVE_PAGE_OFFSET | 0x7ffffff000) as *mut _;
pub trait TableLevel {}
......
......@@ -3,6 +3,7 @@ use alloc::collections::VecDeque;
use core::intrinsics;
use spin::Mutex;
use arch::paging::PAGE_SIZE;
use ipi::{ipi, IpiKind, IpiTarget};
use memory::Frame;
use paging::{ActivePageTable, InactivePageTable, Page, PageIter, PhysicalAddress, VirtualAddress};
......@@ -67,7 +68,7 @@ impl Grant {
pub fn map_inactive(from: VirtualAddress, to: VirtualAddress, size: usize, flags: EntryFlags, new_table: &mut InactivePageTable, temporary_page: &mut TemporaryPage) -> Grant {
let mut active_table = unsafe { ActivePageTable::new() };
let mut frames = VecDeque::new();
let mut frames = VecDeque::with_capacity(size/PAGE_SIZE);
let start_page = Page::containing_address(from);
let end_page = Page::containing_address(VirtualAddress::new(from.get() + size - 1));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment