@@ -10,6 +10,7 @@ use bootloader_api::{
10
10
} ;
11
11
use bootloader_boot_config:: { BootConfig , LevelFilter } ;
12
12
use core:: { alloc:: Layout , arch:: asm, mem:: MaybeUninit , slice} ;
13
+ use legacy_memory_region:: UsedMemorySlice ;
13
14
use level_4_entries:: UsedLevel4Entries ;
14
15
use usize_conversions:: FromUsize ;
15
16
use x86_64:: {
@@ -123,16 +124,17 @@ impl<'a> Kernel<'a> {
123
124
/// This function is a convenience function that first calls [`set_up_mappings`], then
124
125
/// [`create_boot_info`], and finally [`switch_to_kernel`]. The given arguments are passed
125
126
/// 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 > (
127
128
kernel : Kernel ,
128
129
boot_config : BootConfig ,
129
- mut frame_allocator : LegacyFrameAllocator < I , D > ,
130
+ mut frame_allocator : LegacyFrameAllocator < I , D , S > ,
130
131
mut page_tables : PageTables ,
131
132
system_info : SystemInfo ,
132
133
) -> !
133
134
where
134
135
I : ExactSizeIterator < Item = D > + Clone ,
135
136
D : LegacyMemoryRegion ,
137
+ S : Iterator < Item = UsedMemorySlice > ,
136
138
{
137
139
let config = kernel. config ;
138
140
let mut mappings = set_up_mappings (
@@ -168,9 +170,9 @@ where
168
170
///
169
171
/// This function reacts to unexpected situations (e.g. invalid kernel ELF file) with a panic, so
170
172
/// errors are not recoverable.
171
- pub fn set_up_mappings < I , D > (
173
+ pub fn set_up_mappings < I , D , S > (
172
174
kernel : Kernel ,
173
- frame_allocator : & mut LegacyFrameAllocator < I , D > ,
175
+ frame_allocator : & mut LegacyFrameAllocator < I , D , S > ,
174
176
page_tables : & mut PageTables ,
175
177
framebuffer : Option < & RawFrameBufferInfo > ,
176
178
config : & BootloaderConfig ,
@@ -179,6 +181,7 @@ pub fn set_up_mappings<I, D>(
179
181
where
180
182
I : ExactSizeIterator < Item = D > + Clone ,
181
183
D : LegacyMemoryRegion ,
184
+ S : Iterator < Item = UsedMemorySlice > ,
182
185
{
183
186
let kernel_page_table = & mut page_tables. kernel ;
184
187
@@ -466,17 +469,18 @@ pub struct Mappings {
466
469
/// address space at the same address. This makes it possible to return a Rust
467
470
/// reference that is valid in both address spaces. The necessary physical frames
468
471
/// are taken from the given `frame_allocator`.
469
- pub fn create_boot_info < I , D > (
472
+ pub fn create_boot_info < I , D , S > (
470
473
config : & BootloaderConfig ,
471
474
boot_config : & BootConfig ,
472
- mut frame_allocator : LegacyFrameAllocator < I , D > ,
475
+ mut frame_allocator : LegacyFrameAllocator < I , D , S > ,
473
476
page_tables : & mut PageTables ,
474
477
mappings : & mut Mappings ,
475
478
system_info : SystemInfo ,
476
479
) -> & ' static mut BootInfo
477
480
where
478
481
I : ExactSizeIterator < Item = D > + Clone ,
479
482
D : LegacyMemoryRegion ,
483
+ S : Iterator < Item = UsedMemorySlice > ,
480
484
{
481
485
log:: info!( "Allocate bootinfo" ) ;
482
486
0 commit comments