Skip to content

Conversation

@fogti
Copy link

@fogti fogti commented Nov 19, 2025

Depends upon hermit-os/hermit-entry#61.

TODO:

  • What allocator should be used for the decompressed bytes?
    • this is particularly important for UEFI, as we switch the global allocator there during boot.
    • Where do we get the start address for the one-shot allocator from?
    • Should we limit the maximum size that the one-shot allocator can allocate (besides the usize::MAX / 2 restriction)?
  • FDT Bikeshedding / naming of entries
    • memory range of image (necessary because this is memory that can't be used by the kernel; chosen,image_reg: [u64;2] = (offset, length))
  • boot_kernel for os=none (e.g. multiboot, firecracker, etc.) needs to gain an argument to pass an optional image range along. It might be a good idea to introduce a structure for "FDT parameters" to make further extensions easier in the future.

@fogti fogti force-pushed the decompress branch 2 times, most recently from da963be to b87905f Compare November 23, 2025 20:00
@fogti fogti force-pushed the decompress branch 4 times, most recently from c03df71 to 3dcc652 Compare November 27, 2025 15:20
/// A simple, `!Sync` implementation of a one-shot allocator.
///
/// This allocator manages the provided memory.
pub struct OneshotAllocator {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: this might have to interact with the paging subsystem.

src/os/mod.rs Outdated
}
}

//#[cfg(any(target_os = "none", feature = "fc"))]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The boot_kernel functions appear to not be limited by cfg conditionals, so this is also unconditional, for now.

@fogti fogti force-pushed the decompress branch 2 times, most recently from 0d9d117 to 18130d0 Compare November 27, 2025 16:18

unsafe impl Allocator for OneshotAllocator {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
assert!(layout.align() <= 8);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done because we can't change the alignment during reallocation/ growth.

@fogti fogti force-pushed the decompress branch 5 times, most recently from 31f545b to 38cac76 Compare December 5, 2025 13:01
@fogti fogti force-pushed the decompress branch 2 times, most recently from ba5a841 to ac15df4 Compare December 8, 2025 13:47
@fogti
Copy link
Author

fogti commented Dec 8, 2025

Obvious mistakes — found via cargo xtask clippy — are fixed now.

@fogti
Copy link
Author

fogti commented Dec 10, 2025

TODO: fix non-UEFI version (currently, it should always panic) and test UEFI versoin (which should pretty much work as-is) using hermit-os/kernel#2077 as the kernel (using HERMIT_MANIFEST_DIR to specify a local checkout of that PR).

@fogti fogti force-pushed the decompress branch 2 times, most recently from 7045b5e to 5dce468 Compare December 10, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant