From f3d84e8645e1f6318c7e34f3524cd332ac6deef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Thu, 10 Apr 2025 07:55:30 +0000 Subject: Remove zombie code --- arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch') 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 da3c8ff..377533c 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 @@ -116,9 +116,6 @@ namespace teachos::arch::memory::heap memory_block * first; ///< First free entry in our memory. stl::mutex mutex; ///< Mutex to ensure only one thread calls allocate or deallocate at once. }; - - extern linked_list_allocator kernel_heap; - } // namespace teachos::arch::memory::heap #endif // TEACHOS_ARCH_X86_64_MEMORY_HEAP_LINKED_LIST_ALLOCATOR_HPP -- cgit v1.2.3 From 5a8659adaa54ce9514db72d1e40f33dec88605ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Thu, 10 Apr 2025 08:06:50 +0000 Subject: Move interrupt count into seperate variable --- .../interrupt_descriptor_table/interrupt_descriptor_table.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp b/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp index 9b62110..80f01a8 100644 --- a/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp +++ b/arch/x86_64/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp @@ -8,17 +8,20 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table { namespace { + /// @brief Amount of currently reserved interrupt indicies. + /// See https://wiki.osdev.org/Interrupt_Descriptor_Table#IDT_items for more information. + constexpr uint8_t RESERVED_INTERRUPT_COUNT = 32U; + auto create_interrupt_descriptor_table() -> interrupt_descriptor_table { - // Only account for the reserved Vectors for now (0 - 31) - interrupt_descriptor_table interrupt_descriptor_table{32}; + interrupt_descriptor_table interrupt_descriptor_table{RESERVED_INTERRUPT_COUNT}; uint64_t offset = reinterpret_cast(interrupt_handling::generic_interrupt_handler); segment_selector selector{1U, segment_selector::REQUEST_LEVEL_KERNEL}; ist_offset ist{0U}; idt_flags flags{idt_flags::DESCRIPTOR_LEVEL_KERNEL | idt_flags::INTERRUPT_GATE | idt_flags::PRESENT}; - for (std::size_t i = 0; i < 32; i++) + for (std::size_t i = 0; i < interrupt_descriptor_table.size(); i++) { interrupt_descriptor_table.at(i) = {selector, ist, flags, offset}; } -- cgit v1.2.3 From 862d7f33414132cb73f7f3968250a071d78c191b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Thu, 10 Apr 2025 08:10:10 +0000 Subject: Replace iret with iretq (64-bit) --- arch/x86_64/src/kernel/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index 7787f30..daaf216 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -66,7 +66,7 @@ namespace teachos::arch::kernel "mov %%ax, %%gs" : /* No output from call */ : [input] "m"(segment_selector_b)); - asm volatile("iret" + asm volatile("iretq" : /* No output from call */ : /* No input to call */); } @@ -74,7 +74,7 @@ namespace teachos::arch::kernel [[gnu::naked]] auto iret() -> void { - asm volatile("iret" + asm volatile("iretq" : /* No output from call */ : /* No input to call */); } -- cgit v1.2.3 From c2d22838c0500970f275069f19d2a0bd2a016d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Thu, 10 Apr 2025 09:26:50 +0000 Subject: Also add iretq to boot.s --- arch/x86_64/src/boot/boot.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s index 85ae1a1..5a49d48 100644 --- a/arch/x86_64/src/boot/boot.s +++ b/arch/x86_64/src/boot/boot.s @@ -375,7 +375,7 @@ context_switch: // instruction address to return to push test_function - iret + iretq test_function: cli -- cgit v1.2.3