Skip to content

Commit

Permalink
fix(x86_64): make kernel_heap_end a valid virtual address
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Klimt <[email protected]>
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening and jounathaen committed Nov 18, 2024
1 parent dca9fe1 commit a0c9c3a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/arch/x86_64/mm/virtualmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ pub fn allocate_aligned(size: usize, align: usize) -> Result<VirtAddr, AllocErro

pub fn deallocate(virtual_address: VirtAddr, size: usize) {
assert!(
virtual_address < kernel_heap_end(),
"Virtual address {virtual_address:p} is not < kernel_heap_end()"
virtual_address <= kernel_heap_end(),
"Virtual address {virtual_address:p} is not <= kernel_heap_end()"
);
assert_eq!(
virtual_address % BasePageSize::SIZE,
Expand Down Expand Up @@ -121,8 +121,8 @@ pub fn deallocate(virtual_address: VirtAddr, size: usize) {
virtual_address
);
assert!(
virtual_address < kernel_heap_end(),
"Virtual address {:#X} is not < kernel_heap_end()",
virtual_address <= kernel_heap_end(),
"Virtual address {:#X} is not <= kernel_heap_end()",
virtual_address
);
assert_eq!(
Expand Down Expand Up @@ -157,12 +157,12 @@ pub fn print_information() {
info!("Virtual memory free list:\n{free_list}");
}

/// End of the virtual memory address space reserved for kernel memory.
/// This also marks the start of the virtual memory address space reserved for the task heap.
/// End of the virtual memory address space reserved for kernel memory (inclusive).
/// The virtual memory address space reserved for the task heap starts after this.
#[cfg(not(feature = "common-os"))]
#[inline]
pub const fn kernel_heap_end() -> VirtAddr {
VirtAddr(0x8000_0000_0000u64)
VirtAddr(0x7FFF_FFFF_FFFFu64)
}

#[cfg(feature = "common-os")]
Expand Down

0 comments on commit a0c9c3a

Please sign in to comment.