aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-14 08:15:16 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-14 08:15:16 +0000
commit8beb8b758c33cf1ac5357b31296927e7df8cf971 (patch)
tree318ec0b5086ef1309ebcea876cf1cd0020090744 /arch/x86_64/src/memory
parentb3c8a1819226b7dbaad82623c8294b99c91297ef (diff)
downloadteachos-8beb8b758c33cf1ac5357b31296927e7df8cf971.tar.xz
teachos-8beb8b758c33cf1ac5357b31296927e7df8cf971.zip
Fix typos, implementation in header and missing doxygen
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/frame_allocator.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/x86_64/src/memory/frame_allocator.cpp b/arch/x86_64/src/memory/frame_allocator.cpp
index 829cd6d..3ad2d96 100644
--- a/arch/x86_64/src/memory/frame_allocator.cpp
+++ b/arch/x86_64/src/memory/frame_allocator.cpp
@@ -2,6 +2,34 @@
namespace teachos::arch::memory
{
+ frame::frame(std::size_t frame_number)
+ : frame_number(frame_number)
+ {
+ // Nothing to do
+ }
+
+ auto frame::containing_address(std::size_t address) -> frame { return frame{address / PAGE_FRAME_SIZE}; }
+
+ memory_area_iterator::memory_area_iterator(memory_area * p)
+ : ptr(p)
+ {
+ // Nothing to do
+ }
+
+ memory_area & memory_area_iterator::operator*() const { return *ptr; }
+
+ auto memory_area_iterator::operator++(int) -> memory_area_iterator
+ {
+ ++(*this);
+ return *this;
+ }
+
+ auto memory_area_iterator::operator++() -> memory_area_iterator &
+ {
+ ++ptr;
+ return *this;
+ }
+
auto area_frame_allocator::choose_next_area() -> void
{
current_area = std::nullopt;
@@ -77,4 +105,8 @@ namespace teachos::arch::memory
{
}
}
+
+ auto area_frame_allocator::begin() -> memory_area_iterator { return area_begin; }
+
+ auto area_frame_allocator::end() -> memory_area_iterator { return area_end; }
} // namespace teachos::arch::memory