aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/allocator
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory/allocator')
-rw-r--r--arch/x86_64/src/memory/allocator/area_frame_allocator.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp b/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp
index e03c66a..6ec3e95 100644
--- a/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp
+++ b/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp
@@ -28,7 +28,7 @@ namespace teachos::arch::memory::allocator
return physical_frame::containing_address(address) >= next_free_frame;
});
- auto lowest_area_with_free_frames =
+ auto const lowest_area_with_free_frames =
std::ranges::min_element(next_area_with_free_frames, [](multiboot::memory_area a, multiboot::memory_area b) {
return a.base_address < b.base_address;
});
@@ -37,7 +37,7 @@ namespace teachos::arch::memory::allocator
{
current_area = *lowest_area_with_free_frames;
// Update the `next_free_frame` according to the new memory area
- auto start_frame = physical_frame::containing_address(current_area.value().base_address);
+ auto const start_frame = physical_frame::containing_address(current_area.value().base_address);
if (next_free_frame < start_frame)
{
next_free_frame = start_frame;
@@ -47,16 +47,14 @@ namespace teachos::arch::memory::allocator
auto area_frame_allocator::allocate_frame() -> std::optional<physical_frame>
{
- /*
- * Only try to allocate memory if current_area is not null, because
- * the current_area is null if there is no more available memory.
- */
+ // Only try to allocate memory if current_area is not null, because
+ // the current_area is null if there is no more available memory.
if (!current_area.has_value())
{
return std::nullopt;
}
- auto address = current_area.value().base_address + current_area.value().area_length - 1;
+ auto const address = current_area.value().base_address + current_area.value().area_length - 1;
physical_frame current_area_last_frame = physical_frame::containing_address(address);
if (next_free_frame > current_area_last_frame)