Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b0cae12

Browse filesBrowse files
committed
Ensure MemoryRegions are aligned to 4096
1 parent 9b3efcb commit b0cae12
Copy full SHA for b0cae12

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎common/src/legacy_memory_region.rs

Copy file name to clipboardExpand all lines: common/src/legacy_memory_region.rs
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use core::{
55
mem::MaybeUninit,
66
};
77
use x86_64::{
8+
align_down, align_up,
89
structures::paging::{FrameAllocator, PhysFrame, Size4KiB},
910
PhysAddr,
1011
};
@@ -232,9 +233,12 @@ where
232233
.map(|start| UsedMemorySlice::new_from_len(start.as_u64(), ramdisk_slice_len)),
233234
)
234235
.chain(used_slices)
236+
.map(|slice| UsedMemorySlice {
237+
start: align_down(slice.start, 0x1000),
238+
end: align_up(slice.end, 0x1000),
239+
})
235240
}
236241

237-
// TODO unit test
238242
fn split_and_add_region<'a, U>(
239243
mut region: MemoryRegion,
240244
regions: &mut [MaybeUninit<MemoryRegion>],
@@ -347,7 +351,6 @@ where
347351
#[cfg(test)]
348352
mod tests {
349353
use super::*;
350-
use bootloader_api::info::MemoryRegionKind;
351354

352355
#[derive(Copy, Clone, Debug)]
353356
struct TestMemoryRegion {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.