Pre-allocate x86 kernel PD entries
This commit is contained in:
2
rmm
2
rmm
Submodule rmm updated: df733ed571...0d4ff5d4f3
@@ -14,6 +14,7 @@ use rmm::{
|
||||
FrameCount,
|
||||
FrameUsage,
|
||||
MemoryArea,
|
||||
PageEntry,
|
||||
PageFlags,
|
||||
PageMapper,
|
||||
PhysicalAddress,
|
||||
@@ -105,6 +106,14 @@ unsafe fn inner<A: Arch>(
|
||||
&mut bump_allocator
|
||||
).expect("failed to create Mapper");
|
||||
|
||||
// Pre-allocate all kernel PD entries so that when the page table is copied,
|
||||
// these entries are synced between processes
|
||||
for i in 512..1024 {
|
||||
let phys = mapper.allocator_mut().allocate_one().expect("failed to map page table");
|
||||
let flags = A::ENTRY_FLAG_READWRITE | A::ENTRY_FLAG_DEFAULT_TABLE;
|
||||
mapper.table().set_entry(i, PageEntry::new(phys.data() | flags));
|
||||
}
|
||||
|
||||
// Map all physical areas at PHYS_OFFSET
|
||||
for area in areas.iter() {
|
||||
for i in 0..area.size / A::PAGE_SIZE {
|
||||
|
||||
@@ -76,10 +76,7 @@ pub fn resource() -> Result<Vec<u8>> {
|
||||
format!("{}", ticks)
|
||||
};
|
||||
|
||||
let mut memory = 0;
|
||||
if let Some(ref kfx) = context.kstack {
|
||||
memory += kfx.len();
|
||||
}
|
||||
let mut memory = context.kfx.len();
|
||||
if let Some(ref kstack) = context.kstack {
|
||||
memory += kstack.len();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user