aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-18 14:45:05 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-18 14:46:17 +0000
commit8d39f3f67734bf39cada370c39243e6ef33bf4a0 (patch)
tree50493df40018c2ea9587280ac8d7bc3fb42a4990 /arch/x86_64/include
parent1b5a771a34743a2973a82de5ebdfd22da030b841 (diff)
downloadteachos-8d39f3f67734bf39cada370c39243e6ef33bf4a0.tar.xz
teachos-8d39f3f67734bf39cada370c39243e6ef33bf4a0.zip
Make new usable for both kernel and user calls
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp8
-rw-r--r--arch/x86_64/include/arch/context_switching/syscall/main.hpp3
-rw-r--r--arch/x86_64/include/arch/kernel/cpu/segment_register.hpp1
-rw-r--r--arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp6
4 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp b/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
index 5be449f..82719bc 100644
--- a/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
+++ b/arch/x86_64/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
@@ -67,6 +67,14 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
auto contains_flags(std::bitset<3U> other) const -> bool;
/**
+ * @brief Gets the index into the global descriptor table this segment selector is pointing too.
+ *
+ * @return Underlying value of the index field, bit 3 - 16.
+ */
+ [[gnu::section(".user_text")]]
+ auto get_index() const -> uint16_t;
+
+ /**
* @brief Defaulted three-way comparsion operator.
*/
auto operator<=>(segment_selector const & other) const -> std::strong_ordering = default;
diff --git a/arch/x86_64/include/arch/context_switching/syscall/main.hpp b/arch/x86_64/include/arch/context_switching/syscall/main.hpp
index 9d61f97..e391c1f 100644
--- a/arch/x86_64/include/arch/context_switching/syscall/main.hpp
+++ b/arch/x86_64/include/arch/context_switching/syscall/main.hpp
@@ -19,6 +19,9 @@ namespace teachos::arch::context_switching::syscall
/// parameters and uses them as out parameters instead, where arg_0 is the start of the newly
/// mapped heap area and arg_1 is the size of the entire area. Can be less than 100 KiB if less
/// space remains.
+ ASSERT = 3U, /// Loads the arg_0 parameter as a boolean which needs to be true or it will print the message in
+ /// arg_1 parameter onto the VGA buffer screen, keep it as a nullptr if it shouldn't print anything
+ /// and then it halts the further execution of the application.
};
/**
diff --git a/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp b/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp
index 36ada23..a236452 100644
--- a/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp
+++ b/arch/x86_64/include/arch/kernel/cpu/segment_register.hpp
@@ -31,6 +31,7 @@ namespace teachos::arch::kernel::cpu
*
* @return Segment Selector pointing to the currently loaded Code Segment.
*/
+ [[gnu::section(".user_text")]]
auto read_code_segment_register() -> context_switching::interrupt_descriptor_table::segment_selector;
/**
diff --git a/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp b/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp
index 6fcab6f..c98c130 100644
--- a/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp
+++ b/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp
@@ -97,16 +97,22 @@ namespace teachos::arch::memory::heap
};
} // namespace teachos::arch::memory::heap
+[[gnu::section(".user_text")]]
auto operator new(std::size_t size) -> void *;
+[[gnu::section(".user_text")]]
auto operator delete(void * pointer) noexcept -> void;
+[[gnu::section(".user_text")]]
auto operator delete(void * pointer, std::size_t size) noexcept -> void;
+[[gnu::section(".user_text")]]
auto operator new[](std::size_t size) -> void *;
+[[gnu::section(".user_text")]]
auto operator delete[](void * pointer) noexcept -> void;
+[[gnu::section(".user_text")]]
auto operator delete[](void * pointer, std::size_t size) noexcept -> void;
#endif // TEACHOS_ARCH_X86_64_MEMORY_HEAP_GLOBAL_HEAP_ALLOCATOR_HPP