aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-16 11:52:01 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-16 11:52:01 +0000
commitf56004a77314d4b4d68bfaf496fd7c6013ba7a27 (patch)
treedcd74becf45f2e8832b85534939caac9d8391b10 /arch
parent0c4fd9eaed4a71975879aa83cd2da4b6266a64b5 (diff)
downloadteachos-f56004a77314d4b4d68bfaf496fd7c6013ba7a27.tar.xz
teachos-f56004a77314d4b4d68bfaf496fd7c6013ba7a27.zip
Adjust types
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/include/arch/memory/paging.hpp10
-rw-r--r--arch/x86_64/src/boot/boot.s2
-rw-r--r--arch/x86_64/src/memory/paging.cpp10
3 files changed, 10 insertions, 12 deletions
diff --git a/arch/x86_64/include/arch/memory/paging.hpp b/arch/x86_64/include/arch/memory/paging.hpp
index 7b705ac..c13c3fe 100644
--- a/arch/x86_64/include/arch/memory/paging.hpp
+++ b/arch/x86_64/include/arch/memory/paging.hpp
@@ -91,9 +91,6 @@ namespace teachos::arch::memory
*/
auto contains_flags(std::bitset<64U> other) const -> bool;
- std::bitset<64U> flags; ///< Underlying bitset used to read the flags from. Bits 9 - 11 and 52 - 62 can be freely
- ///< used for additional flags by the operating system.
-
private:
/**
* @brief Extracts the physical address from the underlying bitset read from bit index 12 - 51. Is a 52 bit page
@@ -103,6 +100,9 @@ namespace teachos::arch::memory
* @return Extracted physical address of the next page or of the frame for P1 page tables.
*/
auto calculate_physical_address() const -> std::size_t;
+
+ std::bitset<64U> flags; ///< Underlying bitset used to read the flags from. Bits 9 - 11 and 52 - 62 can be freely
+ ///< used for additional flags by the operating system.
};
/**
@@ -132,7 +132,7 @@ namespace teachos::arch::memory
* @param index
* @return An optional of the next page table or null
*/
- auto next_table(size_t index) const -> std::optional<const page_table *>;
+ auto next_table(std::size_t index) const -> std::optional<const page_table *>;
/**
* @brief Index operator overload to access specific entries directy
@@ -140,7 +140,7 @@ namespace teachos::arch::memory
* @param index
* @return The address of the accessed entry
*/
- entry & operator[](size_t index)
+ entry & operator[](std::size_t index)
{
arch::exception_handling::assert(index < PAGE_TABLE_ENTRY_COUNT, "[Page Table] index out of bounds");
return entries[index];
diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s
index 29ac58d..e3d9c37 100644
--- a/arch/x86_64/src/boot/boot.s
+++ b/arch/x86_64/src/boot/boot.s
@@ -268,7 +268,7 @@ enable_paging:
mov $page_map_level_4, %eax
or 0b11, %eax
// TODO: WHY THIS THROW ERROR?
- mov %eax, [$page_map_level_4 + 511 * 8]
+ //mov %eax, [$page_map_level_4 + 511 * 8]
/* Enable Physical Address Extension */
mov %cr4, %eax
diff --git a/arch/x86_64/src/memory/paging.cpp b/arch/x86_64/src/memory/paging.cpp
index 61d9d0f..2f78da8 100644
--- a/arch/x86_64/src/memory/paging.cpp
+++ b/arch/x86_64/src/memory/paging.cpp
@@ -60,19 +60,17 @@ namespace teachos::arch::memory
std::size_t table_address = reinterpret_cast<std::size_t>(this);
return (table_address << 9) | (index << 12);
}
- else
- {
- return std::nullopt;
- }
+ // TODO: Implement behaviour for huge pages currently not done
+ return std::nullopt;
}
- auto page_table::next_table(size_t index) const -> std::optional<const page_table *>
+ auto page_table::next_table(std::size_t index) const -> std::optional<page_table const *>
{
auto address = next_table_address(index);
if (address.has_value())
{
- return reinterpret_cast<const page_table *>(*address);
+ return reinterpret_cast<page_table const *>(*address);
}
return std::nullopt;