File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1
1
use os_bootinfo:: { MemoryMap , MemoryRegion , MemoryRegionType } ;
2
2
use x86_64:: structures:: paging:: { PhysFrame , PAGE_SIZE } ;
3
+ use x86_64:: align_up;
3
4
4
5
pub ( crate ) struct FrameAllocator < ' a > {
5
6
pub memory_map : & ' a mut MemoryMap ,
@@ -16,6 +17,7 @@ impl<'a> FrameAllocator<'a> {
16
17
if region. len < page_size {
17
18
continue ;
18
19
}
20
+
19
21
assert_eq ! (
20
22
0 ,
21
23
region. start_addr. as_u64( ) & 0xfff ,
@@ -61,14 +63,16 @@ impl<'a> FrameAllocator<'a> {
61
63
self . add_region_overwrite ( region, false ) ;
62
64
}
63
65
64
- fn add_region_overwrite ( & mut self , region : MemoryRegion , overwrite : bool ) {
66
+ fn add_region_overwrite ( & mut self , mut region : MemoryRegion , overwrite : bool ) {
65
67
assert_eq ! (
66
68
0 ,
67
69
region. start_addr. as_u64( ) & 0xfff ,
68
70
"Region start address is not page aligned: {:?}" ,
69
71
region
70
72
) ;
71
73
74
+ region. len = align_up ( region. len , PAGE_SIZE . into ( ) ) ;
75
+
72
76
let mut region_already_inserted = false ;
73
77
let mut split_region = None ;
74
78
You can’t perform that action at this time.
0 commit comments