Don't physmap the kernel itself
We don't actually need to and this is a bit safer against memory corruption.
This commit is contained in:
@@ -328,7 +328,7 @@ unsafe fn map_memory<A: Arch>(areas: &[MemoryArea], mut bump_allocator: &mut Bum
|
||||
let kernel_area = (*MEMORY_MAP.get()).kernel().unwrap();
|
||||
let kernel_base = kernel_area.start;
|
||||
let kernel_size = kernel_area.end.saturating_sub(kernel_area.start);
|
||||
// Map kernel at KERNEL_OFFSET and identity map too
|
||||
// Map kernel at KERNEL_OFFSET
|
||||
for i in 0..kernel_size / A::PAGE_SIZE {
|
||||
let phys = PhysicalAddress::new(kernel_base + i * PAGE_SIZE);
|
||||
let virt = VirtualAddress::new(
|
||||
@@ -339,12 +339,6 @@ unsafe fn map_memory<A: Arch>(areas: &[MemoryArea], mut bump_allocator: &mut Bum
|
||||
.map_phys(virt, phys, flags)
|
||||
.expect("failed to map frame");
|
||||
flush.ignore(); // Not the active table
|
||||
|
||||
let virt = A::phys_to_virt(phys);
|
||||
let flush = mapper
|
||||
.map_phys(virt, phys, flags)
|
||||
.expect("failed to map frame");
|
||||
flush.ignore(); // Not the active table
|
||||
}
|
||||
|
||||
for area in (*MEMORY_MAP.get()).identity_mapped() {
|
||||
|
||||
Reference in New Issue
Block a user