1
- use core :: ops :: Deref ;
1
+ use alloc :: boxed :: Box ;
2
2
use elf_rs:: { ElfFile , ProgramHeaderEntry , ProgramType } ;
3
3
use multiboot2:: {
4
- BootLoaderNameTag , CommandLineTag , MemoryArea , MemoryAreaType , MemoryMapTag , ModuleTag ,
5
- SmbiosTag ,
4
+ BootLoaderNameTag , CommandLineTag , MaybeDynSized , MemoryArea , MemoryAreaType , MemoryMapTag ,
5
+ ModuleTag , SmbiosTag ,
6
6
} ;
7
7
8
8
/// 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) -> ! {
43
43
// that the basic data structures are usable.
44
44
45
45
// 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" ) )
49
49
// random non-sense memory map
50
- . memory_map_tag ( & MemoryMapTag :: new ( & [ MemoryArea :: new (
50
+ . mmap ( MemoryMapTag :: new ( & [ MemoryArea :: new (
51
51
0 ,
52
52
0xffffffff ,
53
53
MemoryAreaType :: Reserved ,
54
54
) ] ) )
55
- . add_module_tag ( & ModuleTag :: new (
55
+ . add_module ( ModuleTag :: new (
56
56
elf_mod. start as u32 ,
57
57
elf_mod. end as u32 ,
58
58
elf_mod. string . unwrap ( ) ,
59
59
) )
60
60
// 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 ] ) )
65
63
. build ( ) ;
66
64
65
+ let mbi = Box :: leak ( mbi) ;
66
+
67
67
log:: info!(
68
68
"Handing over to ELF: {}" ,
69
69
elf_mod. string. unwrap_or( "<unknown>" )
@@ -74,7 +74,7 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! {
74
74
core:: arch:: asm!(
75
75
"jmp *%ecx" ,
76
76
in( "eax" ) multiboot2:: MAGIC ,
77
- in( "ebx" ) mbi. as_ptr( ) as u32 ,
77
+ in( "ebx" ) mbi. as_ptr( ) ,
78
78
in( "ecx" ) elf. entry_point( ) as u32 ,
79
79
options( noreturn, att_syntax) ) ;
80
80
}
0 commit comments