Skip to content

Commit

Permalink
Merge #97
Browse files Browse the repository at this point in the history
97: x86_64: Have 0x800000 as minimal physical memory start r=stlankes a=mkroening

Workaround for #96.

Co-authored-by: Martin Kröning <mkroening@posteo.net>
  • Loading branch information
bors[bot] and mkroening authored May 24, 2022
2 parents 09f6fe3 + bf56601 commit 988ec1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use self::bootinfo::*;
use crate::arch::x86_64::paging::{BasePageSize, LargePageSize, PageSize, PageTableEntryFlags};
use crate::arch::x86_64::serial::SerialPort;
use core::ptr::{copy, write_bytes};
use core::{mem, slice};
use core::{cmp, mem, slice};
use goblin::elf;
use multiboot::information::{MemoryManagement, Multiboot, PAddr};

Expand Down Expand Up @@ -99,8 +99,11 @@ pub unsafe fn find_kernel() -> &'static [u8] {
let elf_len = end_address - start_address;
loaderlog!("Module length: {:#x}", elf_len);

let free_memory_address = align_up!(end_address, LargePageSize::SIZE);
// TODO: Workaround for https://github.com/hermitcore/rusty-loader/issues/96
let free_memory_address = cmp::max(free_memory_address, 0x800000);
// Memory after the highest end address is unused and available for the physical memory manager.
physicalmem::init(align_up!(end_address, LargePageSize::SIZE));
physicalmem::init(free_memory_address);

// Identity-map the ELF header of the first module.
assert!(
Expand Down

0 comments on commit 988ec1c

Please # to comment.