From d1ef184af6a8a282cd70b6959e93abaf1027ab17 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 10 Oct 2024 11:54:14 -0400 Subject: [PATCH] bootloader: Add remove_{physical|virtual}_allocated_range methods. Will be used in following commits. Change-Id: Ica89d28cbf6980aca8dc347dfdcb200a0e637e9a Reviewed-on: https://review.haiku-os.org/c/haiku/+/8442 Reviewed-by: waddlesplash --- headers/private/kernel/boot/addr_range.h | 4 ++++ src/system/boot/loader/kernel_args.cpp | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/headers/private/kernel/boot/addr_range.h b/headers/private/kernel/boot/addr_range.h index a6ef1737b2..662987e8f3 100644 --- a/headers/private/kernel/boot/addr_range.h +++ b/headers/private/kernel/boot/addr_range.h @@ -36,7 +36,11 @@ status_t remove_physical_memory_range(uint64 start, uint64 size); uint64 total_physical_memory(); status_t insert_physical_allocated_range(uint64 start, uint64 size); +status_t remove_physical_allocated_range(uint64 start, uint64 size); + status_t insert_virtual_allocated_range(uint64 start, uint64 size); +status_t remove_virtual_allocated_range(uint64 start, uint64 size); + void ignore_physical_memory_ranges_beyond_4gb(); #ifdef __cplusplus diff --git a/src/system/boot/loader/kernel_args.cpp b/src/system/boot/loader/kernel_args.cpp index 74a63185f5..8792e4a70c 100644 --- a/src/system/boot/loader/kernel_args.cpp +++ b/src/system/boot/loader/kernel_args.cpp @@ -317,6 +317,15 @@ insert_physical_allocated_range(uint64 start, uint64 size) } +status_t +remove_physical_allocated_range(uint64 start, uint64 size) +{ + return remove_address_range(gKernelArgs.physical_allocated_range, + &gKernelArgs.num_physical_allocated_ranges, MAX_PHYSICAL_ALLOCATED_RANGE, + start, size); +} + + status_t insert_virtual_allocated_range(uint64 start, uint64 size) { @@ -326,6 +335,15 @@ insert_virtual_allocated_range(uint64 start, uint64 size) } +status_t +remove_virtual_allocated_range(uint64 start, uint64 size) +{ + return remove_address_range(gKernelArgs.virtual_allocated_range, + &gKernelArgs.num_virtual_allocated_ranges, MAX_VIRTUAL_ALLOCATED_RANGE, + start, size); +} + + #if B_HAIKU_PHYSICAL_BITS > 32 void