Skip to content

Commit 2548c25

Browse files
committed
use VirtAddr instead of &'static mut BootInfo
In the future, we'll no longer map the BootInfo into the bootloader's page tables, so we can't/shouldn't create a mutable reference to it. We don't need to use a &'static mut anyway using VirtAddr works just as well.
1 parent 8d4379b commit 2548c25

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

common/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ pub fn create_boot_info<I, D>(
474474
page_tables: &mut PageTables,
475475
mappings: &mut Mappings,
476476
system_info: SystemInfo,
477-
) -> &'static mut BootInfo
477+
) -> VirtAddr
478478
where
479479
I: ExactSizeIterator<Item = D> + Clone,
480480
D: LegacyMemoryRegion,
@@ -579,15 +579,11 @@ where
579579
info
580580
});
581581

582-
boot_info
582+
boot_info_addr
583583
}
584584

585585
/// Switches to the kernel address space and jumps to the kernel entry point.
586-
pub fn switch_to_kernel(
587-
page_tables: PageTables,
588-
mappings: Mappings,
589-
boot_info: &'static mut BootInfo,
590-
) -> ! {
586+
pub fn switch_to_kernel(page_tables: PageTables, mappings: Mappings, boot_info: VirtAddr) -> ! {
591587
let PageTables {
592588
kernel_level_4_frame,
593589
..
@@ -637,7 +633,7 @@ unsafe fn context_switch(addresses: Addresses) -> ! {
637633
in(reg) addresses.page_table.start_address().as_u64(),
638634
in(reg) addresses.stack_top.as_u64(),
639635
in(reg) addresses.entry_point.as_u64(),
640-
in("rdi") addresses.boot_info as *const _ as usize,
636+
in("rdi") addresses.boot_info.as_u64(),
641637
);
642638
}
643639
unreachable!();
@@ -648,7 +644,7 @@ struct Addresses {
648644
page_table: PhysFrame,
649645
stack_top: VirtAddr,
650646
entry_point: VirtAddr,
651-
boot_info: &'static mut BootInfo,
647+
boot_info: VirtAddr,
652648
}
653649

654650
fn mapping_addr_page_aligned(

0 commit comments

Comments
 (0)