Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support higher half position independent kernels #289

Merged
merged 3 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ rustflags = [
"-C",
"link-args=--image-base 0xFFFF800000000000",
"-C",
"relocation-model=static", # pic in higher half not supported yet
"relocation-model=pic",
"-C",
"code-model=large",
]
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn build_uefi_bootloader(out_dir: &Path) -> PathBuf {
// local build
cmd.arg("--path").arg("uefi");
println!("cargo:rerun-if-changed=uefi");
println!("cargo:rerun-if-changed=common");
} else {
cmd.arg("--version").arg(BOOTLOADER_X86_64_UEFI_VERSION);
}
Expand Down Expand Up @@ -132,6 +133,10 @@ fn build_bios_stage_2(out_dir: &Path) -> PathBuf {
// local build
cmd.arg("--path").arg(&local_path);
println!("cargo:rerun-if-changed={}", local_path.display());
println!(
"cargo:rerun-if-changed={}",
local_path.with_file_name("common").display()
);
} else {
cmd.arg("--version")
.arg(BOOTLOADER_X86_64_BIOS_STAGE_2_VERSION);
Expand Down
8 changes: 4 additions & 4 deletions common/src/level_4_entries.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{entropy, BootInfo, RawFrameBufferInfo};
use crate::{entropy, load_kernel::VirtualAddressOffset, BootInfo, RawFrameBufferInfo};
use bootloader_api::{config, info::MemoryRegion, BootloaderConfig};
use core::{alloc::Layout, iter::Step};
use rand::{
Expand Down Expand Up @@ -126,11 +126,11 @@ impl UsedLevel4Entries {
pub fn mark_segments<'a>(
&mut self,
segments: impl Iterator<Item = ProgramHeader<'a>>,
virtual_address_offset: u64,
virtual_address_offset: VirtualAddressOffset,
) {
for segment in segments.filter(|s| s.mem_size() > 0) {
self.mark_range_as_used(
segment.virtual_addr() + virtual_address_offset,
virtual_address_offset + segment.virtual_addr(),
segment.mem_size(),
);
}
Expand Down Expand Up @@ -158,7 +158,7 @@ impl UsedLevel4Entries {
// Choose the first index.
free_entries.next()
};
let idx = idx_opt.expect("no usable level 4 entries found");
let Some(idx) = idx_opt else { panic!("no usable level 4 entries found ({num} entries requested)"); };

// Mark the entries as used.
for i in 0..num.into_usize() {
Expand Down
Loading