Pre-allocate x86 kernel PD entries

This commit is contained in:
Jeremy Soller
2022-08-21 13:21:59 -06:00
parent bdba700c21
commit d3fbbd5918
3 changed files with 11 additions and 5 deletions

2
rmm

Submodule rmm updated: df733ed571...0d4ff5d4f3

View File

@@ -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 {

View File

@@ -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();
}