diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-13 10:58:34 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-13 10:58:34 +0000 |
| commit | b3c8a1819226b7dbaad82623c8294b99c91297ef (patch) | |
| tree | 30a489862647c2573f6e0d723e0107f0e74869e0 /arch/x86_64/src/memory | |
| parent | 553f3a824511bb8107982b2b2737f5b1dff59855 (diff) | |
| download | teachos-b3c8a1819226b7dbaad82623c8294b99c91297ef.tar.xz teachos-b3c8a1819226b7dbaad82623c8294b99c91297ef.zip | |
continue implementing frame allocator
Diffstat (limited to 'arch/x86_64/src/memory')
| -rw-r--r-- | arch/x86_64/src/memory/frame_allocator.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/x86_64/src/memory/frame_allocator.cpp b/arch/x86_64/src/memory/frame_allocator.cpp index 3793ac6..829cd6d 100644 --- a/arch/x86_64/src/memory/frame_allocator.cpp +++ b/arch/x86_64/src/memory/frame_allocator.cpp @@ -5,19 +5,18 @@ namespace teachos::arch::memory auto area_frame_allocator::choose_next_area() -> void { current_area = std::nullopt; - auto begin = areas; - auto end = areas + 5; - // TODO: Fix this loop as soon as you've created an area iterator - for (auto area = begin; area != end; ++area) + for (memory_area_iterator it = begin(); it != end(); ++it) { - std::size_t address = area->base_address + area->area_length - 1; + memory_area & area = *it; + + std::size_t address = area.base_address + area.area_length - 1; if (frame::containing_address(address) >= next_free_frame) { // The `next_free_frame` address is smaller than the last address of the current area - if (!current_area || area->base_address < current_area->base_address) + if (!current_area || area.base_address < current_area->base_address) { - current_area = *area; + current_area = area; } } } |
