feat(heap): refacto memory init and add heap simple allocation
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
juju committed 2021-12-08 22:47:46 +01:00
1 parent 2433d99bc7
commit 37432ef902
8 files changed
+157 -56

No files matched your search

+6 -5
View File
@@ -13,6 +13,7 @@ mod temporary_page;
pub const P4: *mut PageTable = 0o177777_777_777_777_777_0000 as *mut _;
fn get_flags_from_elf_section(section: &ElfSection) -> Flags {
use multiboot2::{ELF_SECTION_ALLOCATED, ELF_SECTION_EXECUTABLE, ELF_SECTION_WRITABLE};
@@ -31,17 +32,16 @@ fn get_flags_from_elf_section(section: &ElfSection) -> Flags {
flags
}
pub fn kernel_remap<A>(allocator: &mut A, boot_info: &BootInformation)
where
A: FrameAllocator<Size4KiB>,
pub fn kernel_remap<'a, A>(allocator: &mut A, boot_info: & BootInformation) -> RecursivePageTable<'a>
where A: FrameAllocator<Size4KiB>,
{
println!("Remapping kernel");
let mut temporary_page = TemporaryPage::new(
Page::containing_address(VirtAddr::new(0xcafebabe)),
allocator,
);
let mut active_table = get_active_page_table();
let mut new_table = {
let mut active_table: RecursivePageTable = get_active_page_table();
let mut new_table: InactivePageTable = {
let frame = allocator.allocate_frame().expect("No more frames");
InactivePageTable::new(frame, &mut active_table, &mut temporary_page)
};
@@ -109,6 +109,7 @@ where
));
active_table.unmap(old_p4_page).expect("Failed to unmap old P4").1.flush();
println!("Stack guard page at {:#x}", old_p4_page.start_address());
active_table
}
struct InactivePageTable {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.