1- use core :: ops :: Deref ;
1+ use alloc :: boxed :: Box ;
22use elf_rs:: { ElfFile , ProgramHeaderEntry , ProgramType } ;
33use multiboot2:: {
4- BootLoaderNameTag , CommandLineTag , MemoryArea , MemoryAreaType , MemoryMapTag , ModuleTag ,
5- SmbiosTag ,
4+ BootLoaderNameTag , CommandLineTag , MaybeDynSized , MemoryArea , MemoryAreaType , MemoryMapTag ,
5+ ModuleTag , SmbiosTag ,
66} ;
77
88/// Loads the first module into memory. Assumes that the module is a ELF file.
@@ -43,27 +43,27 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! {
4343 // that the basic data structures are usable.
4444
4545 // build MBI
46- let mbi = multiboot2:: builder :: InformationBuilder :: new ( )
47- . bootloader_name_tag ( & BootLoaderNameTag :: new ( "mb2_integrationtest_chainloader" ) )
48- . command_line_tag ( & CommandLineTag :: new ( "chainloaded YEAH" ) )
46+ let mbi = multiboot2:: Builder :: new ( )
47+ . bootloader ( BootLoaderNameTag :: new ( "mb2_integrationtest_chainloader" ) )
48+ . cmdline ( CommandLineTag :: new ( "chainloaded YEAH" ) )
4949 // random non-sense memory map
50- . memory_map_tag ( & MemoryMapTag :: new ( & [ MemoryArea :: new (
50+ . mmap ( MemoryMapTag :: new ( & [ MemoryArea :: new (
5151 0 ,
5252 0xffffffff ,
5353 MemoryAreaType :: Reserved ,
5454 ) ] ) )
55- . add_module_tag ( & ModuleTag :: new (
55+ . add_module ( ModuleTag :: new (
5656 elf_mod. start as u32 ,
5757 elf_mod. end as u32 ,
5858 elf_mod. string . unwrap ( ) ,
5959 ) )
6060 // Test that we can add SmbiosTag multiple times.
61- . add_tag ( SmbiosTag :: new ( 1 , 1 , & [ 1 , 2 , 3 ] ) . deref ( ) )
62- . unwrap ( )
63- . add_tag ( SmbiosTag :: new ( 1 , 2 , & [ 1 , 2 , 3 ] ) . deref ( ) )
64- . expect ( "should allow tag multiple times" )
61+ . add_smbios ( SmbiosTag :: new ( 1 , 1 , & [ 1 , 2 , 3 ] ) )
62+ . add_smbios ( SmbiosTag :: new ( 2 , 3 , & [ 4 , 5 , 6 ] ) )
6563 . build ( ) ;
6664
65+ let mbi = Box :: leak ( mbi) ;
66+
6767 log:: info!(
6868 "Handing over to ELF: {}" ,
6969 elf_mod. string. unwrap_or( "<unknown>" )
@@ -74,7 +74,7 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! {
7474 core:: arch:: asm!(
7575 "jmp *%ecx" ,
7676 in( "eax" ) multiboot2:: MAGIC ,
77- in( "ebx" ) mbi. as_ptr( ) as u32 ,
77+ in( "ebx" ) mbi. as_ptr( ) ,
7878 in( "ecx" ) elf. entry_point( ) as u32 ,
7979 options( noreturn, att_syntax) ) ;
8080 }
0 commit comments