1
1
use crate :: frame_allocator:: FrameAllocator ;
2
2
use bootloader:: bootinfo:: MemoryRegionType ;
3
3
use fixedvec:: FixedVec ;
4
+ use x86_64:: structures:: paging:: mapper:: { MapToError , MapperFlush , UnmapError } ;
4
5
use x86_64:: structures:: paging:: {
5
- Mapper , Page , PageSize , PageTableFlags , PhysFrame , Size4KiB , self , RecursivePageTable ,
6
+ self , Mapper , Page , PageSize , PageTableFlags , PhysFrame , RecursivePageTable , Size4KiB ,
6
7
} ;
7
- use x86_64:: structures:: paging:: mapper:: { UnmapError , MapToError , MapperFlush } ;
8
8
use x86_64:: { align_up, PhysAddr , VirtAddr } ;
9
9
use xmas_elf:: program:: { self , ProgramHeader64 } ;
10
10
@@ -68,7 +68,8 @@ pub(crate) fn map_segment(
68
68
for frame in PhysFrame :: range_inclusive ( start_frame, end_frame) {
69
69
let offset = frame - start_frame;
70
70
let page = start_page + offset;
71
- unsafe { map_page ( page, frame, page_table_flags, page_table, frame_allocator) ? } . flush ( ) ;
71
+ unsafe { map_page ( page, frame, page_table_flags, page_table, frame_allocator) ? }
72
+ . flush ( ) ;
72
73
}
73
74
74
75
if mem_size > file_size {
@@ -93,7 +94,8 @@ pub(crate) fn map_segment(
93
94
page_table,
94
95
frame_allocator,
95
96
) ?
96
- } . flush ( ) ;
97
+ }
98
+ . flush ( ) ;
97
99
98
100
type PageArray = [ u64 ; Size4KiB :: SIZE as usize / 8 ] ;
99
101
@@ -123,7 +125,8 @@ pub(crate) fn map_segment(
123
125
page_table,
124
126
frame_allocator,
125
127
) ?
126
- } . flush ( ) ;
128
+ }
129
+ . flush ( ) ;
127
130
}
128
131
129
132
// Map additional frames.
@@ -136,7 +139,10 @@ pub(crate) fn map_segment(
136
139
let frame = frame_allocator
137
140
. allocate_frame ( MemoryRegionType :: Kernel )
138
141
. ok_or ( MapToError :: FrameAllocationFailed ) ?;
139
- unsafe { map_page ( page, frame, page_table_flags, page_table, frame_allocator) ? } . flush ( ) ;
142
+ unsafe {
143
+ map_page ( page, frame, page_table_flags, page_table, frame_allocator) ?
144
+ }
145
+ . flush ( ) ;
140
146
}
141
147
142
148
// zero
0 commit comments