@@ -11,8 +11,7 @@ use memory_addresses::arch::aarch64::{PhysAddr, VirtAddr};
1111use crate :: arch:: aarch64:: kernel:: CURRENT_STACK_ADDRESS ;
1212use crate :: arch:: aarch64:: kernel:: core_local:: core_scheduler;
1313use crate :: arch:: aarch64:: mm:: paging:: { BasePageSize , PageSize , PageTableEntryFlags } ;
14- use crate :: mm:: physicalmem:: PHYSICAL_FREE_LIST ;
15- use crate :: mm:: virtualmem:: KERNEL_FREE_LIST ;
14+ use crate :: mm:: { FrameAlloc , PageAlloc , PageRangeAllocator } ;
1615#[ cfg( target_os = "none" ) ]
1716use crate :: scheduler:: PerCoreSchedulerExt ;
1817use crate :: scheduler:: task:: { Task , TaskFrame } ;
@@ -128,12 +127,10 @@ impl TaskStacks {
128127 } ;
129128 let total_size = user_stack_size + DEFAULT_STACK_SIZE ;
130129 let layout = PageLayout :: from_size ( total_size + 3 * BasePageSize :: SIZE as usize ) . unwrap ( ) ;
131- let page_range = KERNEL_FREE_LIST . lock ( ) . allocate ( layout) . unwrap ( ) ;
130+ let page_range = PageAlloc :: allocate ( layout) . unwrap ( ) ;
132131 let virt_addr = VirtAddr :: from ( page_range. start ( ) ) ;
133132 let frame_layout = PageLayout :: from_size ( total_size) . unwrap ( ) ;
134- let frame_range = PHYSICAL_FREE_LIST
135- . lock ( )
136- . allocate ( frame_layout)
133+ let frame_range = FrameAlloc :: allocate ( frame_layout)
137134 . expect ( "Failed to allocate Physical Memory for TaskStacks" ) ;
138135 let phys_addr = PhysAddr :: from ( frame_range. start ( ) ) ;
139136
@@ -238,14 +235,14 @@ impl Drop for TaskStacks {
238235 )
239236 . unwrap ( ) ;
240237 unsafe {
241- KERNEL_FREE_LIST . lock ( ) . deallocate ( range) . unwrap ( ) ;
238+ PageAlloc :: deallocate ( range) ;
242239 }
243240
244241 let range =
245242 PageRange :: from_start_len ( stacks. phys_addr . as_usize ( ) , stacks. total_size )
246243 . unwrap ( ) ;
247244 unsafe {
248- PHYSICAL_FREE_LIST . lock ( ) . deallocate ( range) . unwrap ( ) ;
245+ FrameAlloc :: deallocate ( range) ;
249246 }
250247 }
251248 }
0 commit comments