Skip to content

Commit 4446278

Browse files
committed
Trivial PR changes
1 parent e09e68a commit 4446278

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

bios/stage-4/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ fn used_memory_slices(info: &BiosInfo) -> impl Iterator<Item = UsedMemorySlice>
224224
[info.stage_3, info.stage_4, info.config_file]
225225
.into_iter()
226226
.map(|region| UsedMemorySlice {
227-
start: PhysAddr::new(region.start).as_u64(),
228-
len: region.len,
227+
start: region.start,
228+
end: region.start + region.len,
229229
})
230230
}
231231

common/src/legacy_memory_region.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use x86_64::{
1414
pub struct UsedMemorySlice {
1515
/// the physical start of the slice
1616
pub start: u64,
17-
/// the length of the slice
18-
pub len: u64,
17+
/// The physical end address (exclusive) of the region.
18+
pub end: u64,
1919
}
2020

2121
/// Abstraction trait for a memory region returned by the UEFI or BIOS firmware.
@@ -46,7 +46,7 @@ pub struct LegacyFrameAllocator<I, D, S> {
4646
}
4747

4848
/// Start address of the first frame that is not part of the lower 1MB of frames
49-
const LOWER_MEMORY_END_PAGE: u64 = 0x100_000;
49+
const LOWER_MEMORY_END_PAGE: u64 = 0x10_0000;
5050

5151
impl<I, D> LegacyFrameAllocator<I, D, Empty<UsedMemorySlice>>
5252
where
@@ -212,15 +212,15 @@ where
212212
bootloader: UsedMemorySlice {
213213
start: min_frame.start_address().as_u64(),
214214
// TODO: unit test that this is not an off by 1
215-
len: next_free.start_address() - min_frame.start_address(),
215+
end: next_free.start_address() - min_frame.start_address(),
216216
},
217217
kernel: UsedMemorySlice {
218218
start: kernel_slice_start.as_u64(),
219-
len: kernel_slice_len,
219+
end: kernel_slice_len,
220220
},
221221
ramdisk: ramdisk_slice_start.map(|start| UsedMemorySlice {
222222
start: start.as_u64(),
223-
len: ramdisk_slice_len,
223+
end: ramdisk_slice_len,
224224
}),
225225
state: KernelRamIterState::Bootloader,
226226
}
@@ -243,7 +243,7 @@ where
243243
}
244244

245245
for slice in used_slices.clone() {
246-
let slice_end = slice.start + slice.len;
246+
let slice_end = slice.start + slice.end;
247247
if region.end <= slice.start || region.start >= slice_end {
248248
// region and slice don't overlap
249249
continue;

0 commit comments

Comments
 (0)