aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--arch/x86_64/CMakeLists.txt8
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp67
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/gdt_flags.hpp25
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp22
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp16
-rw-r--r--arch/x86_64/include/arch/context_switching/descriptor_table/type_field.hpp84
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/lgdt.hpp11
-rw-r--r--arch/x86_64/include/arch/memory/allocator/physical_frame.hpp6
-rw-r--r--arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp4
-rw-r--r--arch/x86_64/include/arch/memory/multiboot/elf_symbols_section.hpp6
-rw-r--r--arch/x86_64/include/arch/memory/multiboot/memory_map.hpp6
-rw-r--r--arch/x86_64/include/arch/memory/paging/virtual_page.hpp2
-rw-r--r--arch/x86_64/include/arch/stl/container.hpp (renamed from arch/x86_64/include/arch/shared/container.hpp)10
-rw-r--r--arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp (renamed from arch/x86_64/include/arch/shared/contiguous_pointer_iterator.hpp)10
-rw-r--r--arch/x86_64/include/arch/stl/forward_value_iterator.hpp (renamed from arch/x86_64/include/arch/shared/forward_value_iterator.hpp)10
-rw-r--r--arch/x86_64/include/arch/stl/mutex.hpp (renamed from arch/x86_64/include/arch/shared/mutex.hpp)10
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/access_byte.cpp10
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/gdt_flags.cpp14
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table.cpp40
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/global_descriptor_table_pointer.cpp12
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/segment_descriptor.cpp17
-rw-r--r--arch/x86_64/src/context_switching/descriptor_table/type_field.cpp12
-rw-r--r--arch/x86_64/src/kernel/cpu/lgdt.cpp13
-rw-r--r--arch/x86_64/src/kernel/cpu/ss.cpp8
-rw-r--r--arch/x86_64/src/kernel/main.cpp13
-rw-r--r--arch/x86_64/src/memory/heap/linked_list_allocator.cpp2
-rw-r--r--arch/x86_64/src/stl/mutex.cpp (renamed from arch/x86_64/src/shared/mutex.cpp)6
28 files changed, 210 insertions, 242 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index daf87b8..c895618 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,11 +123,11 @@ add_library("_context" OBJECT)
add_library("teachos::context_switching" ALIAS "_context")
#[============================================================================[
-# The Shared Library
+# The Context switching Library
#]============================================================================]
-add_library("_shared" OBJECT)
-add_library("teachos::shared" ALIAS "_shared")
+add_library("_stl" OBJECT)
+add_library("teachos::stl" ALIAS "_stl")
#[============================================================================[
# The Kernel
@@ -143,7 +143,7 @@ target_link_libraries("_kernel" PRIVATE
"teachos::video"
"teachos::memory"
"teachos::exception"
- "teachos::shared"
+ "teachos::stl"
"teachos::context_switching"
)
diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt
index 53339d2..912daf6 100644
--- a/arch/x86_64/CMakeLists.txt
+++ b/arch/x86_64/CMakeLists.txt
@@ -65,11 +65,11 @@ target_sources("_memory" PRIVATE
)
#[============================================================================[
-# The Shared Library
+# The STL Library
#]============================================================================]
-target_sources("_shared" PRIVATE
- "src/shared/mutex.cpp"
+target_sources("_stl" PRIVATE
+ "src/stl/mutex.cpp"
)
#[============================================================================[
@@ -91,8 +91,8 @@ target_sources("_context" PRIVATE
"src/context_switching/descriptor_table/access_byte.cpp"
"src/context_switching/descriptor_table/gdt_flags.cpp"
"src/context_switching/descriptor_table/global_descriptor_table.cpp"
+ "src/context_switching/descriptor_table/global_descriptor_table_pointer.cpp"
"src/context_switching/descriptor_table/segment_descriptor.cpp"
- "src/context_switching/descriptor_table/type_field.cpp"
)
#[============================================================================[
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp
index dc4de03..bafce8d 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/access_byte.hpp
@@ -2,9 +2,8 @@
#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_ACCESS_BYTE_HPP
#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_ACCESS_BYTE_HPP
-#include "arch/context_switching/descriptor_table/type_field.hpp"
-
#include <bitset>
+#include <cstdint>
namespace teachos::arch::context_switching::descriptor_table
{
@@ -12,24 +11,49 @@ namespace teachos::arch::context_switching::descriptor_table
* @brief Defines helper function for all states that the access byte field of a segment descriptor can
* have.
*/
- struct access_byte
+ struct [[gnu::packed]] access_byte
{
/**
* @brief Possible set bits in our underlying std::bitset and the meaning when they are set.
*/
enum bitset : uint8_t
{
- CODE_OR_DATA_SEGMENT = 1U << 0U, ///< Defines a system segment (if 0) or a code/data segment (if 1).
- ACCESS_LEVEL_KERNEL = 0, ///< Highest privileged level used by the kernel to allow for full access of resources.
+ ACCESSED =
+ 1U
+ << 0U, ///< Whether the segment has been accessed since the last time the operating system has cleared the
+ ///< flag. If enabled it has been accessed, otherwise it has not been accessed since the last clear.
+ WRITABLE = 1U << 1U, ///< Indicates if the data segment is writable or not. If enabled the code segment allows
+ ///< read and write access, otherwise only read access is possible.
+ READABLE = 1U << 1U, ///< Indicates if the code segment is readable or not. If enabled the code segment allows
+ ///< read and execute access, otherwise only executable access is possible.
+ CONFORMING =
+ 1U << 2U, ///< Indicates if the code is allowed to be executed by different access levels
+ ///< (higher or lower) in code segments. If enabled the code segment allows access, otherwise
+ ///< access from different privilege levels with throw a General-Protectione exception.
+ EXPAND_DOWN = 1U << 2U, ///< Indicates if the expansion direction is up or down in data segments. If enabled the
+ ///< data segment expands downwards, otherwise it expands upwards.
+ CODE_SEGMENT = 1U << 3U, ///< Further defines the actual type of the segment. If enabled this segment is a code
+ ///< segment, otherwise its a data segment.
+ LOCAL_DESCRIPTOR_TABLE = 2, ///< The actual type of sytem segment is a local descriptor table.
+ TASK_STATE_SEGMENT_AVAILABLE =
+ 9, ///< The actual type of sytem segment is a task state segment that is still available.
+ TASK_STATE_SEGMENT_BUSY = 11, ///< The actual type of sytem segment is a task state segment that is currently in
+ ///< use and therefore busy.
+ CALL_GATE = 11, ///< The actual type of sytem segment is a call gate.
+ INTERRUPT_GATE = 14, ///< The actual type of sytem segment is a interrupt gate.
+ TRAP_GATE = 15, ///< The actual type of sytem segment is a trap gate.
+ CODE_OR_DATA_SEGMENT = 1U << 4U, ///< Defines a system segment (if 0) or a code/data segment (if 1).
+ ACCESS_LEVEL_KERNEL =
+ 0U << 4U, ///< Highest privileged level used by the kernel to allow for full access of resources.
ACCESS_LEVEL_ADMIN =
- 2, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
- ///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
+ 2U << 4U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
+ ///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
ACCESS_LEVEL_PRIVILEGED_USER =
- 4, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more than
- ///< two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
- ACCESS_LEVEL_USER = 6, ///< Restricts access to only application and their specific memory.
- PRESENT = 1U << 3U, ///< Present bit; Allows an entry to refer to a valid segment.
- ///< Must be set (1) for any valid segment.
+ 4U << 4U, ///< Restricts access to own application and thoose of lower privilege. Should only be used if more
+ ///< than two privilege levels are required, otherwise using Level 3 and Level 0 is recommended.
+ ACCESS_LEVEL_USER = 6U << 4U, ///< Restricts access to only application and their specific memory.
+ PRESENT = 1U << 3U << 4U, ///< Present bit; Allows an entry to refer to a valid segment.
+ ///< Must be set (1) for any valid segment.
};
/**
@@ -40,10 +64,11 @@ namespace teachos::arch::context_switching::descriptor_table
/**
* @brief Constructor.
*
- * @param flags Left-most four bits of the access_byte.
- * @param type_field Right-most four bits of the access_byte representing the type_field.
+ * @param flags Allows to set flags for the access byte field using the unscoped enum contained in this class, used
+ * to allow for direct integer conversion. This value is saved and can later be used to check whether certain flags
+ * are enabled or not using contains_flags method.
*/
- access_byte(uint8_t flags, uint8_t type_field);
+ access_byte(uint8_t flags);
/**
* @brief Checks if the given std::bitset is a subset or equivalent to the underlying std::bitset.
@@ -54,14 +79,7 @@ namespace teachos::arch::context_switching::descriptor_table
* @param other Flags that we want to compare against and check if the underlying std::bitset has the same bits set.
* @return Whether the given flags are a subset or equivalent with the underlying std::bitset.
*/
- auto contains_flags(std::bitset<4U> other) const -> bool;
-
- /**
- * @brief Returns the type field of the access byte.
- *
- * @return Copy of the underlying type field bits.
- */
- auto get_type_field() const -> type_field;
+ auto contains_flags(std::bitset<8U> other) const -> bool;
/**
* @brief Allows to compare the underlying std::bitset of two instances.
@@ -72,8 +90,7 @@ namespace teachos::arch::context_switching::descriptor_table
auto operator==(access_byte const & other) const -> bool = default;
private:
- std::bitset<4U> _flags = {}; ///< Underlying bitset used to read the flags from.
- type_field _type = {}; ///< Field specifying the type of the segment descriptor and its settings.
+ uint8_t _flags = {}; ///< Underlying bitset used to read the flags from.
};
} // namespace teachos::arch::context_switching::descriptor_table
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/gdt_flags.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/gdt_flags.hpp
index f27284e..11f5dd4 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/gdt_flags.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/gdt_flags.hpp
@@ -11,7 +11,7 @@ namespace teachos::arch::context_switching::descriptor_table
* @brief Defines helper function for all states that the flags field of a segment descriptor can
* have.
*/
- struct gdt_flags
+ struct [[gnu::packed]] gdt_flags
{
/**
* @brief Possible set bits in our underlying std::bitset and the meaning when they are set.
@@ -40,11 +40,14 @@ namespace teachos::arch::context_switching::descriptor_table
/**
* @brief Constructor.
*
- * @param flags Actual value read from the elf section header, which should be converted into a std::bitset, to
- * allow reading the state of single bits more easily. Only the rightmost 3 bit of the value will actually be
- * converted into the std::bitset, because the leftmost 4 bit are irrelevant and the 4th bit is reserved.
+ * @param flags Allows to set flags for the flags field using the unscoped enum contained in this class, used to
+ * allow for direct integer conversion. This value is saved and can later be used to check whether certain flags are
+ * enabled or not using contains_flags method.
+ * @param limit Does not necessarily make sense in the gdt flags type, but because the flags alone are only 4 bit
+ * the type would still require the space for a complete bit. Therefore the 4 bit segment limit field before the
+ * flags field is included in this type to ensure we actually contain 8 bit of data.
*/
- gdt_flags(uint8_t flags);
+ gdt_flags(uint8_t flags, std::bitset<20U> limit);
/**
* @brief Checks if the given std::bitset is a subset or equivalent to the underlying std::bitset.
@@ -58,6 +61,15 @@ namespace teachos::arch::context_switching::descriptor_table
auto contains_flags(std::bitset<4U> other) const -> bool;
/**
+ * @brief Get part of the segment limit that is saved in the gdt flags. This does not necessarily make sense in this
+ * object, but it has to be included here because a struct can not be smaller than a full byte. Therefore we include
+ * the 4 bit segment limit field so that it results in a compelte byte with the addtional 4 bit of gdt flags.
+ *
+ * @return 4-bit limit segment
+ */
+ auto get_limit() const -> std::bitset<4U>;
+
+ /**
* @brief Allows to compare the underlying std::bitset of two instances.
*
* @param other Other instance that we want to compare with.
@@ -66,7 +78,8 @@ namespace teachos::arch::context_switching::descriptor_table
auto operator==(gdt_flags const & other) const -> bool = default;
private:
- std::bitset<4U> _flags = {}; ///< Underlying bitset used to read the flags from.
+ uint8_t _limit_2 : 4 = {};
+ uint8_t _flags : 4 = {}; ///< Underlying bitset used to read the flags from.
};
} // namespace teachos::arch::context_switching::descriptor_table
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp
index d4febe1..ed17be3 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp
@@ -16,10 +16,26 @@ namespace teachos::arch::context_switching::descriptor_table
* This structure is used to store the base address and length of the GDT.
* It is used when loading or modifying the GDT during context switching.
*/
- struct global_descriptor_table_pointer
+ struct [[gnu::packed]] global_descriptor_table_pointer
{
- std::size_t table_length; ///< The size of the GDT in bytes.
- global_descriptor_table * address; ///< Pointer to the GDT base address.
+ /**
+ * @brief Default constructor.
+ */
+ global_descriptor_table_pointer() = default;
+
+ /**
+ * @brief Constructor.
+ */
+ global_descriptor_table_pointer(uint16_t table_length, global_descriptor_table * address);
+
+ /**
+ * @brief Defaulted three-way comparsion operator.
+ */
+ auto operator<=>(global_descriptor_table_pointer const & other) const -> std::strong_ordering = default;
+
+ private:
+ uint16_t table_length = {}; ///< The amount of segment descriptor entries in the global descriptor table - 1.
+ global_descriptor_table * address = {}; ///< Non-owning pointer to the GDT base address.
};
} // namespace teachos::arch::context_switching::descriptor_table
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp
index 86b6c75..7106771 100644
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp
+++ b/arch/x86_64/include/arch/context_switching/descriptor_table/segment_descriptor.hpp
@@ -4,7 +4,6 @@
#include "arch/context_switching/descriptor_table/access_byte.hpp"
#include "arch/context_switching/descriptor_table/gdt_flags.hpp"
#include "arch/context_switching/descriptor_table/segment_descriptor_type.hpp"
-#include "arch/context_switching/descriptor_table/type_field.hpp"
namespace teachos::arch::context_switching::descriptor_table
{
@@ -14,7 +13,7 @@ namespace teachos::arch::context_switching::descriptor_table
/**
* @brief Defines helper function for all states and the actual data the segment descriptor can have.
*/
- struct segment_descriptor
+ struct [[gnu::packed]] segment_descriptor
{
/**
* @brief Default Constructor.
@@ -52,13 +51,12 @@ namespace teachos::arch::context_switching::descriptor_table
private:
// The order in private variables starts for the first variable being the rightmost bit.
- uint16_t _limit_1 = {}; ///< First part of the limit field (0 - 15)
- std::bitset<24U> _base_1 = {}; ///< First part of the base field (16 - 39)
- access_byte _access = {}; ///< Access byte field (40 - 47)
- std::bitset<4U> _limit_2 = {}; ///< Second part of the limit field (48 - 51)
- gdt_flags _flag = {}; ///< Flags field (52 - 55)
- std::bitset<40U> _base_2 = {}; ///< Second part of the base field (56 - 95)
- uint32_t _reserved = {}; ///< Reserved field used to ensure this struct is 128 bits big (96 - 127)
+ uint16_t _limit_1 = {}; ///< First part of the limit field (0 - 15)
+ uint32_t _base_1 : 24 = {}; ///< First part of the base field (16 - 39)
+ access_byte _access = {}; ///< Access byte field (40 - 47)
+ gdt_flags _flag = {}; ///< Second part of the limit field + Flags field (48 - 55)
+ uint64_t _base_2 : 40 = {}; ///< Second part of the base field (56 - 95)
+ uint32_t _reserved = {}; ///< Reserved field used to ensure this struct is 128 bits big (96 - 127)
};
} // namespace teachos::arch::context_switching::descriptor_table
diff --git a/arch/x86_64/include/arch/context_switching/descriptor_table/type_field.hpp b/arch/x86_64/include/arch/context_switching/descriptor_table/type_field.hpp
deleted file mode 100644
index 3822f9c..0000000
--- a/arch/x86_64/include/arch/context_switching/descriptor_table/type_field.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_TYPE_FIELD_HPP
-#define TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_TYPE_FIELD_HPP
-
-#include "arch/context_switching/descriptor_table/segment_descriptor_type.hpp"
-
-#include <bitset>
-
-namespace teachos::arch::context_switching::descriptor_table
-{
- /**
- * @brief Defines helper function for all states that the flags field of a segment descriptor can
- * have.
- */
- struct type_field
- {
- /**
- * @brief Possible set bits in our underlying std::bitset and the meaning when they are set.
- */
- enum bitset : uint8_t
- {
- ACCESSED =
- 1U
- << 0U, ///< Whether the segment has been accessed since the last time the operating system has cleared the
- ///< flag. If enabled it has been accessed, otherwise it has not been accessed since the last clear.
- WRITABLE = 1U << 1U, ///< Indicates if the data segment is writable or not. If enabled the code segment allows
- ///< read and write access, otherwise only read access is possible.
- READABLE = 1U << 1U, ///< Indicates if the code segment is readable or not. If enabled the code segment allows
- ///< read and execute access, otherwise only executable access is possible.
- CONFORMING =
- 1U << 2U, ///< Indicates if the code is allowed to be executed by different access levels
- ///< (higher or lower) in code segments. If enabled the code segment allows access, otherwise
- ///< access from different privilege levels with throw a General-Protectione exception.
- EXPAND_DOWN = 1U << 2U, ///< Indicates if the expansion direction is up or down in data segments. If enabled the
- ///< data segment expands downwards, otherwise it expands upwards.
- CODE_SEGMENT = 1U << 3U, ///< Further defines the actual type of the segment. If enabled this segment is a code
- ///< segment, otherwise its a data segment.
- LOCAL_DESCRIPTOR_TABLE = 2, ///< The actual type of sytem segment is a local descriptor table.
- TASK_STATE_SEGMENT_AVAILABLE =
- 9, ///< The actual type of sytem segment is a task state segment that is still available.
- TASK_STATE_SEGMENT_BUSY = 11, ///< The actual type of sytem segment is a task state segment that is currently in
- ///< use and therefore busy.
- CALL_GATE = 11, ///< The actual type of sytem segment is a call gate.
- INTERRUPT_GATE = 14, ///< The actual type of sytem segment is a interrupt gate.
- TRAP_GATE = 15 ///< The actual type of sytem segment is a trap gate.
- };
-
- /**
- * @brief Default Constructor.
- */
- type_field() = default;
-
- /**
- * @brief Constructor.
- *
- * @param flags Actual value read from the elf section header, which should be converted into a std::bitset, to
- * allow reading the state of single bits more easily.
- */
- type_field(uint8_t flags);
-
- /**
- * @brief Checks if the given std::bitset is a subset or equivalent to the underlying std::bitset.
- *
- * @note Meaning that all bits that are set in the given std::bitset also have to be set in the underlyng
- * std::bitset. Any additional bits that are set are not relevant.
- *
- * @param other Flags that we want to compare against and check if the underlying std::bitset has the same bits set.
- * @return Whether the given flags are a subset or equivalent with the underlying std::bitset.
- */
- auto contains_flags(std::bitset<4U> other) const -> bool;
-
- /**
- * @brief Allows to compare the underlying std::bitset of two instances.
- *
- * @param other Other instance that we want to compare with.
- * @return Whether the underlying std::bitset of both types is the same.
- */
- auto operator==(type_field const & other) const -> bool = default;
-
- private:
- std::bitset<4U> _flags = {}; ///< Underlying bitset used to read the flags from.
- };
-} // namespace teachos::arch::context_switching::descriptor_table
-
-#endif // TEACHOS_ARCH_X86_64_CONTEXT_SWITCHING_DESCRIPTOR_TABLE_TYPE_FIELD_HPP
diff --git a/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp b/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp
index 633d460..85e2949 100644
--- a/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp
+++ b/arch/x86_64/include/arch/kernel/cpu/lgdt.hpp
@@ -8,10 +8,19 @@
namespace teachos::arch::kernel::cpu
{
+
+ /**
+ * @brief Returns the value in the GDTR register.
+ *
+ * @return Value of GDTR register.
+ */
+ auto store_global_descriptor_table() -> context_switching::descriptor_table::global_descriptor_table_pointer;
+
/**
* @brief Loads the global_descriptor_table_pointer into the global descriptor table register (GDTR).
*/
- auto load_global_descriptor_table(context_switching::descriptor_table::global_descriptor_table_pointer gdt_pointer)
+ auto
+ load_global_descriptor_table(context_switching::descriptor_table::global_descriptor_table_pointer const & gdt_pointer)
-> void;
} // namespace teachos::arch::kernel::cpu
diff --git a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
index 7f04042..7ea5517 100644
--- a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
+++ b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
@@ -1,8 +1,8 @@
#ifndef TEACHOS_ARCH_X86_64_MEMORY_ALLOCATOR_PHYSICAL_FRAME_HPP
#define TEACHOS_ARCH_X86_64_MEMORY_ALLOCATOR_PHYSICAL_FRAME_HPP
-#include "arch/shared/container.hpp"
-#include "arch/shared/forward_value_iterator.hpp"
+#include "arch/stl/container.hpp"
+#include "arch/stl/forward_value_iterator.hpp"
#include <compare>
#include <cstdint>
@@ -79,7 +79,7 @@ namespace teachos::arch::memory::allocator
{}; ///< Index number of the current physical frame, used to distinguish it from other frames.
};
- typedef shared::container<shared::forward_value_iterator<physical_frame>> frame_container;
+ typedef stl::container<stl::forward_value_iterator<physical_frame>> frame_container;
} // namespace teachos::arch::memory::allocator
diff --git a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp
index df9e370..da3c8ff 100644
--- a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp
+++ b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp
@@ -3,7 +3,7 @@
#include "arch/memory/heap/heap_allocator.hpp"
#include "arch/memory/heap/memory_block.hpp"
-#include "arch/shared/mutex.hpp"
+#include "arch/stl/mutex.hpp"
namespace teachos::arch::memory::heap
{
@@ -114,7 +114,7 @@ namespace teachos::arch::memory::heap
std::size_t heap_start; ///< Start of the allocatable heap area.
std::size_t heap_end; ///< End of the allocatable heap area.
memory_block * first; ///< First free entry in our memory.
- shared::mutex mutex; ///< Mutex to ensure only one thread calls allocate or deallocate at once.
+ stl::mutex mutex; ///< Mutex to ensure only one thread calls allocate or deallocate at once.
};
extern linked_list_allocator kernel_heap;
diff --git a/arch/x86_64/include/arch/memory/multiboot/elf_symbols_section.hpp b/arch/x86_64/include/arch/memory/multiboot/elf_symbols_section.hpp
index e8f6b0a..4c7470b 100644
--- a/arch/x86_64/include/arch/memory/multiboot/elf_symbols_section.hpp
+++ b/arch/x86_64/include/arch/memory/multiboot/elf_symbols_section.hpp
@@ -2,8 +2,8 @@
#define TEACHOS_ARCH_X86_64_MEMORY_MULTIBOOT_ELF_SYBOLS_SECTION_HPP
#include "arch/memory/multiboot/info.hpp"
-#include "arch/shared/container.hpp"
-#include "arch/shared/contiguous_pointer_iterator.hpp"
+#include "arch/stl/container.hpp"
+#include "arch/stl/contiguous_pointer_iterator.hpp"
#include <bitset>
#include <cstdint>
@@ -162,7 +162,7 @@ namespace teachos::arch::memory::multiboot
///< contained in the section, to ensure byte alignment is actually 4 byte.
};
- typedef shared::container<shared::contiguous_pointer_iterator<elf_section_header>> elf_section_header_container;
+ typedef stl::container<stl::contiguous_pointer_iterator<elf_section_header>> elf_section_header_container;
} // namespace teachos::arch::memory::multiboot
diff --git a/arch/x86_64/include/arch/memory/multiboot/memory_map.hpp b/arch/x86_64/include/arch/memory/multiboot/memory_map.hpp
index c28c986..cc8db8c 100644
--- a/arch/x86_64/include/arch/memory/multiboot/memory_map.hpp
+++ b/arch/x86_64/include/arch/memory/multiboot/memory_map.hpp
@@ -2,8 +2,8 @@
#define TEACHOS_ARCH_X86_64_MEMORY_MULTIBOOT_MEMORY_MAP_HPP
#include "arch/memory/multiboot/info.hpp"
-#include "arch/shared/container.hpp"
-#include "arch/shared/contiguous_pointer_iterator.hpp"
+#include "arch/stl/container.hpp"
+#include "arch/stl/contiguous_pointer_iterator.hpp"
#include <cstdint>
@@ -46,7 +46,7 @@ namespace teachos::arch::memory::multiboot
struct memory_area entries; ///< Specific memory regions.
};
- typedef shared::container<shared::contiguous_pointer_iterator<memory_area>> memory_area_container;
+ typedef stl::container<stl::contiguous_pointer_iterator<memory_area>> memory_area_container;
} // namespace teachos::arch::memory::multiboot
diff --git a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
index d820e82..d9164a0 100644
--- a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
+++ b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
@@ -84,7 +84,7 @@ namespace teachos::arch::memory::paging
{}; ///< Index number of the current virtual page, used to distinguish it from other pages.
};
- typedef shared::container<shared::forward_value_iterator<virtual_page>> page_container;
+ typedef stl::container<stl::forward_value_iterator<virtual_page>> page_container;
} // namespace teachos::arch::memory::paging
diff --git a/arch/x86_64/include/arch/shared/container.hpp b/arch/x86_64/include/arch/stl/container.hpp
index f2fd1dc..b0f513b 100644
--- a/arch/x86_64/include/arch/shared/container.hpp
+++ b/arch/x86_64/include/arch/stl/container.hpp
@@ -1,9 +1,9 @@
-#ifndef TEACHOS_ARCH_X86_64_SHARED_CONTAINER_HPP
-#define TEACHOS_ARCH_X86_64_SHARED_CONTAINER_HPP
+#ifndef TEACHOS_ARCH_X86_64_STL_CONTAINER_HPP
+#define TEACHOS_ARCH_X86_64_STL_CONTAINER_HPP
#include <iterator>
-namespace teachos::arch::shared
+namespace teachos::arch::stl
{
/**
* @brief Minimal iterator concept required for usage in container
@@ -78,6 +78,6 @@ namespace teachos::arch::shared
iterator end_itr = {}; ///< Pointer to one pas the last element of the given template type.
};
-} // namespace teachos::arch::shared
+} // namespace teachos::arch::stl
-#endif // TEACHOS_ARCH_X86_64_SHARED_CONTAINER_HPP
+#endif // TEACHOS_ARCH_X86_64_STL_CONTAINER_HPP
diff --git a/arch/x86_64/include/arch/shared/contiguous_pointer_iterator.hpp b/arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp
index e2520dc..d15d2e2 100644
--- a/arch/x86_64/include/arch/shared/contiguous_pointer_iterator.hpp
+++ b/arch/x86_64/include/arch/stl/contiguous_pointer_iterator.hpp
@@ -1,9 +1,9 @@
-#ifndef TEACHOS_ARCH_X86_64_SHARED_CONTIGUOUS_POINTER_ITERATOR_HPP
-#define TEACHOS_ARCH_X86_64_SHARED_CONTIGUOUS_POINTER_ITERATOR_HPP
+#ifndef TEACHOS_ARCH_X86_64_STL_CONTIGUOUS_POINTER_ITERATOR_HPP
+#define TEACHOS_ARCH_X86_64_STL_CONTIGUOUS_POINTER_ITERATOR_HPP
#include <iterator>
-namespace teachos::arch::shared
+namespace teachos::arch::stl
{
/**
* @brief Generic contiguous iterator for given template type. Allows to easily use this iterator instance in
@@ -185,6 +185,6 @@ namespace teachos::arch::shared
{}; ///< Underlying value the iterator is currently pointing too and should increment or decrement.
};
-} // namespace teachos::arch::shared
+} // namespace teachos::arch::stl
-#endif // TEACHOS_ARCH_X86_64_SHARED_CONTIGUOUS_POINTER_ITERATOR_HPP
+#endif // TEACHOS_ARCH_X86_64_STL_CONTIGUOUS_POINTER_ITERATOR_HPP
diff --git a/arch/x86_64/include/arch/shared/forward_value_iterator.hpp b/arch/x86_64/include/arch/stl/forward_value_iterator.hpp
index c5dfc06..7c30964 100644
--- a/arch/x86_64/include/arch/shared/forward_value_iterator.hpp
+++ b/arch/x86_64/include/arch