|
1 |
| -use crate::{entropy, BootInfo, RawFrameBufferInfo}; |
| 1 | +use crate::{entropy, load_kernel::VirtualAddressOffset, BootInfo, RawFrameBufferInfo}; |
2 | 2 | use bootloader_api::{config, info::MemoryRegion, BootloaderConfig};
|
3 | 3 | use core::{alloc::Layout, iter::Step};
|
4 | 4 | use rand::{
|
@@ -126,11 +126,11 @@ impl UsedLevel4Entries {
|
126 | 126 | pub fn mark_segments<'a>(
|
127 | 127 | &mut self,
|
128 | 128 | segments: impl Iterator<Item = ProgramHeader<'a>>,
|
129 |
| - virtual_address_offset: u64, |
| 129 | + virtual_address_offset: VirtualAddressOffset, |
130 | 130 | ) {
|
131 | 131 | for segment in segments.filter(|s| s.mem_size() > 0) {
|
132 | 132 | self.mark_range_as_used(
|
133 |
| - segment.virtual_addr() + virtual_address_offset, |
| 133 | + virtual_address_offset + segment.virtual_addr(), |
134 | 134 | segment.mem_size(),
|
135 | 135 | );
|
136 | 136 | }
|
@@ -158,7 +158,7 @@ impl UsedLevel4Entries {
|
158 | 158 | // Choose the first index.
|
159 | 159 | free_entries.next()
|
160 | 160 | };
|
161 |
| - let idx = idx_opt.expect("no usable level 4 entries found"); |
| 161 | + let Some(idx) = idx_opt else { panic!("no usable level 4 entries found ({num} entries requested)"); }; |
162 | 162 |
|
163 | 163 | // Mark the entries as used.
|
164 | 164 | for i in 0..num.into_usize() {
|
|
0 commit comments