Skip to content

Commit

Permalink
fix(x86_64/mem): allow deallocating before kernel
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Oct 28, 2024
1 parent 426f669 commit 27d5cb5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/arch/x86_64/mm/physicalmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ pub fn allocate_aligned(size: usize, align: usize) -> Result<PhysAddr, AllocErro
/// This function must only be called from mm::deallocate!
/// Otherwise, it may fail due to an empty node pool (POOL.maintain() is called in virtualmem::deallocate)
pub fn deallocate(physical_address: PhysAddr, size: usize) {
assert!(
physical_address >= PhysAddr(mm::kernel_end_address().as_u64()),
"Physical address {physical_address:p} is not >= KERNEL_END_ADDRESS"
);
assert!(size > 0);
assert_eq!(
size % BasePageSize::SIZE as usize,
Expand Down
4 changes: 0 additions & 4 deletions src/arch/x86_64/mm/virtualmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ pub fn allocate_aligned(size: usize, align: usize) -> Result<VirtAddr, AllocErro
}

pub fn deallocate(virtual_address: VirtAddr, size: usize) {
assert!(
virtual_address >= VirtAddr(mm::kernel_end_address().as_u64()),
"Virtual address {virtual_address:p} is not >= KERNEL_END_ADDRESS"
);
assert!(
virtual_address < kernel_heap_end(),
"Virtual address {virtual_address:p} is not < kernel_heap_end()"
Expand Down

0 comments on commit 27d5cb5

Please sign in to comment.