Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Apr 6, 2023
1 parent 78fb1e5 commit 2d9ae8f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions api/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub struct BootInfo {
pub ramdisk_addr: Optional<u64>,
/// Ramdisk image size, set to 0 if addr is None
pub ramdisk_len: u64,
/// Kernel image address
/// Physical address of the kernel ELF in memory.
pub kernel_addr: u64,
/// Kernel image size
/// Size of the kernel ELF in memory.
pub kernel_len: u64,
/// Kernel image relocation address
/// Virtual address of the loaded kernel image.
pub kernel_image_offset: u64,

#[doc(hidden)]
Expand Down
3 changes: 2 additions & 1 deletion common/src/legacy_memory_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ where
pub fn construct_memory_map(
self,
regions: &mut [MaybeUninit<MemoryRegion>],
kernel_slice_start: u64,
kernel_slice_start: PhysAddr,
kernel_slice_len: u64,
) -> &mut [MemoryRegion] {
let mut next_index = 0;
let kernel_slice_start = kernel_slice_start.as_u64();

for descriptor in self.original {
let mut start = descriptor.start();
Expand Down
14 changes: 7 additions & 7 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ where
enable_write_protect_bit();

let config = kernel.config;
let kernel_slice_start = kernel.start_address as u64;
let kernel_slice_start = PhysAddr::new(kernel.start_address as _);
let kernel_slice_len = u64::try_from(kernel.len).unwrap();

let (kernel_image_offset, entry_point, tls_template) = load_kernel::load_kernel(
Expand Down Expand Up @@ -402,7 +402,7 @@ where

kernel_slice_start,
kernel_slice_len,
kernel_image_offset: kernel_image_offset.as_u64(),
kernel_image_offset,

ramdisk_slice_start,
ramdisk_slice_len,
Expand All @@ -428,11 +428,11 @@ pub struct Mappings {
pub tls_template: Option<TlsTemplate>,

/// Start address of the kernel slice allocation in memory.
pub kernel_slice_start: u64,
pub kernel_slice_start: PhysAddr,
/// Size of the kernel slice allocation in memory.
pub kernel_slice_len: u64,
/// Start address of the kernel image relocated in memory.
pub kernel_image_offset: u64,
/// Relocation offset of the kernel image in virtual memory.
pub kernel_image_offset: VirtAddr,
pub ramdisk_slice_start: Option<VirtAddr>,
pub ramdisk_slice_len: u64,
}
Expand Down Expand Up @@ -547,9 +547,9 @@ where
.map(|addr| addr.as_u64())
.into();
info.ramdisk_len = mappings.ramdisk_slice_len;
info.kernel_addr = mappings.kernel_slice_start as _;
info.kernel_addr = mappings.kernel_slice_start.as_u64();
info.kernel_len = mappings.kernel_slice_len as _;
info.kernel_image_offset = mappings.kernel_image_offset;
info.kernel_image_offset = mappings.kernel_image_offset.as_u64();
info._test_sentinel = boot_config._test_sentinel;
info
});
Expand Down
1 change: 0 additions & 1 deletion src/uefi/pxe.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::path::Path;

use anyhow::Context;
use bootloader_boot_config::BootConfig;

pub fn create_uefi_tftp_folder(
bootloader_path: &Path,
Expand Down

0 comments on commit 2d9ae8f

Please sign in to comment.