Fix recursive mapping, finish kernel remap.

master
WangRunji 6 years ago
parent 677c1bd565
commit 81ff6f13e5

@ -67,7 +67,7 @@ impl MemoryArea {
Some(phys_start) => {
for page in Page::range_of(self.start_addr, self.end_addr) {
let addr = page.start_address();
let target = phys_start + page.start_address() - self.start_addr;
let target = page.start_address() - self.start_addr + phys_start;
self.flags.apply(pt.map(addr, target));
}
}

@ -1 +1 @@
Subproject commit 1022571b07f946add5187f2933f0dabe5819309b
Subproject commit 48c7d74041c38e4f230df02075ad7519c1bf816d

@ -39,7 +39,6 @@ fn remap_the_kernel() {
};
static mut SPACE: [u8; 0x1000] = [0; 0x1000];
let mut ms = unsafe { MemorySet::new_from_raw_space(&mut SPACE, kstack) };
ms.push(MemoryArea::new_identity(stext as usize, etext as usize, MemoryAttr::default().execute().readonly(), "text"));
ms.push(MemoryArea::new_identity(sdata as usize, edata as usize, MemoryAttr::default(), "data"));
ms.push(MemoryArea::new_identity(srodata as usize, erodata as usize, MemoryAttr::default().readonly(), "rodata"));

@ -147,13 +147,9 @@ impl InactivePageTable for InactivePageTable0 {
fn new_bare() -> Self {
let frame = Self::alloc_frame().map(|target| Frame::of_addr(PhysAddr::new(target as u32)))
.expect("failed to allocate frame");
debug!("begin");
active_table().with_temporary_map(&frame, |_, table: &mut RvPageTable| {
debug!("begin1");
table.zero();
table.set_recursive(RECURSIVE_PAGE_PML4, frame.clone());
debug!("begin2");
});
InactivePageTable0 { p2_frame: frame }
}

Loading…
Cancel
Save