11#![ no_std]
22#![ no_main]
33#![ feature( custom_test_frameworks) ]
4- #![ test_runner( osdev_rust :: test_runner) ]
4+ #![ test_runner( kernel :: test_runner) ]
55#![ reexport_test_harness_main = "test_main" ]
66
77extern crate alloc;
88
99use alloc:: { boxed:: Box , vec:: Vec } ;
10- use bootloader:: { BootInfo , entry_point} ;
10+ use bootloader_api:: {
11+ BootInfo ,
12+ config:: { BootloaderConfig , Mapping } ,
13+ entry_point,
14+ } ;
1115use core:: panic:: PanicInfo ;
12- use osdev_rust :: allocator:: HEAP_SIZE ;
16+ use kernel :: allocator:: HEAP_SIZE ;
1317
14- entry_point ! ( main) ;
18+ pub static BOOTLOADER_CONFIG : BootloaderConfig = {
19+ let mut config = BootloaderConfig :: new_default ( ) ;
20+ config. mappings . physical_memory = Some ( Mapping :: FixedAddress ( 0x20000000000 ) ) ;
21+ config
22+ } ;
1523
16- fn main ( boot_info : & ' static BootInfo ) -> ! {
17- use osdev_rust:: allocator;
18- use osdev_rust:: memory:: { self , BootInfoFrameAllocator } ;
24+ entry_point ! ( main, config = & BOOTLOADER_CONFIG ) ;
25+
26+ fn main ( boot_info : & ' static mut BootInfo ) -> ! {
27+ use kernel:: allocator;
28+ use kernel:: memory:: { self , BootInfoFrameAllocator } ;
1929 use x86_64:: VirtAddr ;
2030
21- osdev_rust :: init ( ) ;
31+ kernel :: init ( ) ;
2232
23- let phys_mem_offset = VirtAddr :: new ( boot_info. physical_memory_offset ) ;
33+ let phys_mem_offset = VirtAddr :: new ( boot_info. physical_memory_offset . into_option ( ) . unwrap ( ) ) ;
2434 let mut mapper = unsafe { memory:: init ( phys_mem_offset) } ;
25- let mut frame_allocator = unsafe { BootInfoFrameAllocator :: init ( & boot_info. memory_map ) } ;
35+ let mut frame_allocator = unsafe { BootInfoFrameAllocator :: init ( & boot_info. memory_regions ) } ;
2636 allocator:: init_heap ( & mut mapper, & mut frame_allocator) . expect ( "heap initialization failed" ) ;
2737
2838 test_main ( ) ;
@@ -31,7 +41,7 @@ fn main(boot_info: &'static BootInfo) -> ! {
3141
3242#[ panic_handler]
3343fn panic ( info : & PanicInfo ) -> ! {
34- osdev_rust :: test_panic_handler ( info) ;
44+ kernel :: test_panic_handler ( info) ;
3545}
3646
3747#[ test_case]
0 commit comments