From f83e7bddcf24433adbfc9214e0f8f8139f8b6362 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 1 Dec 2024 18:41:41 +0100 Subject: FIX: Fixing ARM64 execution when booting from bootloader. FIX: Now works both for ARM64 and AMD64 EFI backends. TODO: The ACB backend needs to be done too. Signed-off-by: Amlal El Mahrouss --- dev/ZKAKit/KernelKit/ThreadLocalStorage.inl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'dev/ZKAKit/KernelKit/ThreadLocalStorage.inl') diff --git a/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl b/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl index d9850c01..3683bc4b 100644 --- a/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl +++ b/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl @@ -7,6 +7,7 @@ //! @file ThreadLocalStorage.inl //! @brief Allocate resources from the process's heap storage. +#include "NewKit/ErrorOr.h" #ifndef INC_PROCESS_SCHEDULER_H #include #endif @@ -40,7 +41,25 @@ inline Kernel::Bool tls_delete_ptr(T* obj) noexcept auto ref_process = UserProcessScheduler::The().GetCurrentProcess(); MUST_PASS(ref_process); - return ref_process.Leak().Delete(obj, sizeof(T)); + ErrorOr obj_wrapped{obj}; + + return ref_process.Leak().Delete(obj_wrapped, sizeof(T)); +} + +//! @brief Delete process pointer. +//! @param obj The pointer to delete. +template +inline Kernel::Bool tls_delete_ptr(Kernel::ErrorOr obj) noexcept +{ + return tls_delete_ptr(obj.Leak()); +} + +//! @brief Delete process pointer. +//! @param obj The pointer to delete. +template +inline Kernel::Bool tls_delete_ptr(Kernel::ErrorOr obj) noexcept +{ + return tls_delete_ptr(obj->Leak()); } /// @brief Allocate a C++ class, and then call the constructor of it. -- cgit v1.2.3