@@ -13,7 +13,7 @@ use align_address::Align;
1313#[ cfg( feature = "smp" ) ]
1414use arch:: x86_64:: kernel:: core_local:: * ;
1515use arch:: x86_64:: kernel:: { interrupts, processor} ;
16- use free_list:: { PageLayout , PageRange } ;
16+ use free_list:: PageLayout ;
1717use hermit_sync:: { OnceCell , SpinMutex , without_interrupts} ;
1818use memory_addresses:: { AddrRange , PhysAddr , VirtAddr } ;
1919#[ cfg( feature = "smp" ) ]
@@ -30,7 +30,7 @@ use crate::arch::x86_64::mm::paging::{
3030} ;
3131use crate :: arch:: x86_64:: swapgs;
3232use crate :: config:: * ;
33- use crate :: mm:: { PageAlloc , PageRangeAllocator } ;
33+ use crate :: mm:: { PageAlloc , PageBox , PageRangeAllocator } ;
3434use crate :: scheduler:: CoreId ;
3535use crate :: { arch, env, scheduler} ;
3636
@@ -387,7 +387,7 @@ fn detect_from_acpi() -> Result<PhysAddr, ()> {
387387/// Helper function to search Floating Pointer Structure of the Multiprocessing Specification
388388fn search_mp_floating ( memory_range : AddrRange < PhysAddr > ) -> Result < & ' static ApicMP , ( ) > {
389389 let layout = PageLayout :: from_size ( BasePageSize :: SIZE as usize ) . unwrap ( ) ;
390- let page_range = PageAlloc :: allocate ( layout) . unwrap ( ) ;
390+ let page_range = PageBox :: new ( layout) . unwrap ( ) ;
391391 let virtual_address = VirtAddr :: from ( page_range. start ( ) ) ;
392392
393393 for current_address in memory_range. iter ( ) . step_by ( BasePageSize :: SIZE as usize ) {
@@ -412,13 +412,6 @@ fn search_mp_floating(memory_range: AddrRange<PhysAddr>) -> Result<&'static Apic
412412 }
413413 }
414414
415- // frees obsolete virtual memory region for MMIO devices
416- let range =
417- PageRange :: from_start_len ( virtual_address. as_usize ( ) , BasePageSize :: SIZE as usize ) . unwrap ( ) ;
418- unsafe {
419- PageAlloc :: deallocate ( range) ;
420- }
421-
422415 Err ( ( ) )
423416}
424417
@@ -450,7 +443,7 @@ fn detect_from_mp() -> Result<PhysAddr, ()> {
450443 }
451444
452445 let layout = PageLayout :: from_size ( BasePageSize :: SIZE as usize ) . unwrap ( ) ;
453- let page_range = PageAlloc :: allocate ( layout) . unwrap ( ) ;
446+ let page_range = PageBox :: new ( layout) . unwrap ( ) ;
454447 let virtual_address = VirtAddr :: from ( page_range. start ( ) ) ;
455448
456449 let mut flags = PageTableEntryFlags :: empty ( ) ;
@@ -467,12 +460,6 @@ fn detect_from_mp() -> Result<PhysAddr, ()> {
467460 let mp_config: & ApicConfigTable = unsafe { & * ( ptr:: with_exposed_provenance ( addr) ) } ;
468461 if mp_config. signature != MP_CONFIG_SIGNATURE {
469462 warn ! ( "MP config table invalid!" ) ;
470- let range =
471- PageRange :: from_start_len ( virtual_address. as_usize ( ) , BasePageSize :: SIZE as usize )
472- . unwrap ( ) ;
473- unsafe {
474- PageAlloc :: deallocate ( range) ;
475- }
476463 return Err ( ( ) ) ;
477464 }
478465
0 commit comments