@@ -10,6 +10,7 @@ use bootloader_api::{
1010} ;
1111use bootloader_boot_config:: { BootConfig , LevelFilter } ;
1212use core:: { alloc:: Layout , arch:: asm, mem:: MaybeUninit , slice} ;
13+ use legacy_memory_region:: UsedMemorySlice ;
1314use level_4_entries:: UsedLevel4Entries ;
1415use usize_conversions:: FromUsize ;
1516use x86_64:: {
@@ -123,16 +124,17 @@ impl<'a> Kernel<'a> {
123124/// This function is a convenience function that first calls [`set_up_mappings`], then
124125/// [`create_boot_info`], and finally [`switch_to_kernel`]. The given arguments are passed
125126/// directly to these functions, so see their docs for more info.
126- pub fn load_and_switch_to_kernel < I , D > (
127+ pub fn load_and_switch_to_kernel < I , D , S > (
127128 kernel : Kernel ,
128129 boot_config : BootConfig ,
129- mut frame_allocator : LegacyFrameAllocator < I , D > ,
130+ mut frame_allocator : LegacyFrameAllocator < I , D , S > ,
130131 mut page_tables : PageTables ,
131132 system_info : SystemInfo ,
132133) -> !
133134where
134135 I : ExactSizeIterator < Item = D > + Clone ,
135136 D : LegacyMemoryRegion ,
137+ S : Iterator < Item = UsedMemorySlice > ,
136138{
137139 let config = kernel. config ;
138140 let mut mappings = set_up_mappings (
@@ -168,9 +170,9 @@ where
168170///
169171/// This function reacts to unexpected situations (e.g. invalid kernel ELF file) with a panic, so
170172/// errors are not recoverable.
171- pub fn set_up_mappings < I , D > (
173+ pub fn set_up_mappings < I , D , S > (
172174 kernel : Kernel ,
173- frame_allocator : & mut LegacyFrameAllocator < I , D > ,
175+ frame_allocator : & mut LegacyFrameAllocator < I , D , S > ,
174176 page_tables : & mut PageTables ,
175177 framebuffer : Option < & RawFrameBufferInfo > ,
176178 config : & BootloaderConfig ,
@@ -179,6 +181,7 @@ pub fn set_up_mappings<I, D>(
179181where
180182 I : ExactSizeIterator < Item = D > + Clone ,
181183 D : LegacyMemoryRegion ,
184+ S : Iterator < Item = UsedMemorySlice > ,
182185{
183186 let kernel_page_table = & mut page_tables. kernel ;
184187
@@ -466,17 +469,18 @@ pub struct Mappings {
466469/// address space at the same address. This makes it possible to return a Rust
467470/// reference that is valid in both address spaces. The necessary physical frames
468471/// are taken from the given `frame_allocator`.
469- pub fn create_boot_info < I , D > (
472+ pub fn create_boot_info < I , D , S > (
470473 config : & BootloaderConfig ,
471474 boot_config : & BootConfig ,
472- mut frame_allocator : LegacyFrameAllocator < I , D > ,
475+ mut frame_allocator : LegacyFrameAllocator < I , D , S > ,
473476 page_tables : & mut PageTables ,
474477 mappings : & mut Mappings ,
475478 system_info : SystemInfo ,
476479) -> & ' static mut BootInfo
477480where
478481 I : ExactSizeIterator < Item = D > + Clone ,
479482 D : LegacyMemoryRegion ,
483+ S : Iterator < Item = UsedMemorySlice > ,
480484{
481485 log:: info!( "Allocate bootinfo" ) ;
482486
0 commit comments