aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-12 13:51:12 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-12 13:51:12 +0000
commit29e067867e7a437d12351b481024d4bab431b202 (patch)
tree97479edda8e06ea5b09ee77096ab117b4cfe8499 /arch/x86_64/include
parentee4c61f7313fedd23d01c69ea5036fa38ef6248a (diff)
downloadteachos-29e067867e7a437d12351b481024d4bab431b202.tar.xz
teachos-29e067867e7a437d12351b481024d4bab431b202.zip
Fix crashes because of are frame allocator copy
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/context_switching/syscall/main.hpp6
-rw-r--r--arch/x86_64/include/arch/memory/heap/memory_block.hpp2
-rw-r--r--arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp2
3 files changed, 6 insertions, 4 deletions
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 8587ab2..9d61f97 100644
--- a/arch/x86_64/include/arch/context_switching/syscall/main.hpp
+++ b/arch/x86_64/include/arch/context_switching/syscall/main.hpp
@@ -60,8 +60,8 @@ namespace teachos::arch::context_switching::syscall
*/
struct response
{
- error error_code; ///< Error code returned by the syscall. If it failed all the values will be 0.
- arguments values; ///< Optional return values of the syscall implementation.
+ error error_code; ///< Error code returned by the syscall. If it failed all the values will be 0.
+ arguments values = {}; ///< Optional return values of the syscall implementation.
};
/**
@@ -78,7 +78,7 @@ namespace teachos::arch::context_switching::syscall
* in the arguments struct. So the value can be read and used for further processing.
*/
[[gnu::section(".user_text")]]
- auto syscall(type syscall_number, arguments args) -> response;
+ auto syscall(type syscall_number, arguments args = {}) -> response;
} // namespace teachos::arch::context_switching::syscall
diff --git a/arch/x86_64/include/arch/memory/heap/memory_block.hpp b/arch/x86_64/include/arch/memory/heap/memory_block.hpp
index e1cd288..9d1fb02 100644
--- a/arch/x86_64/include/arch/memory/heap/memory_block.hpp
+++ b/arch/x86_64/include/arch/memory/heap/memory_block.hpp
@@ -18,6 +18,7 @@ namespace teachos::arch::memory::heap
* @param size Amount of free memory of this specific hole.
* @param next Optional pointer to the next free memory.
*/
+ [[gnu::section(".user_text")]]
memory_block(std::size_t size, memory_block * next);
/**
@@ -26,6 +27,7 @@ namespace teachos::arch::memory::heap
* @note Used so the memory can be reused to construct other classes into, without having the old values.
* Required because we cannot call delete, because it causes "undefined reference to `sbrk`".
*/
+ [[gnu::section(".user_text")]]
~memory_block();
std::size_t size; ///< Amount of free memory this hole contains, has to always be atleast 16 bytes to hold the
diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
index 756eeb1..ca7e2f9 100644
--- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
+++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
@@ -45,7 +45,7 @@ namespace teachos::arch::memory::paging
kernel::cpu::write_control_register(kernel::cpu::control_register::CR4, cr4 | 0x80);
temporary_page temporary_page{virtual_page{0xCAFEBABE}, allocator};
- auto & active_table = active_page_table::create_or_get();
+ decltype(auto) active_table = active_page_table::create_or_get();
auto const frame = allocator.allocate_frame();
exception_handling::assert(frame.has_value(),
"[Kernel Mapper] Frame could not be allocated and therefore kernel not mapped");