diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 03:02:43 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 03:02:43 +0100 |
| commit | 83d870e58457a1d335a1d9b9966a6a1887cc297b (patch) | |
| tree | 72888f88c7728c82f3f6df1f4f70591de15eab36 /dev/kernel/KernelKit/IPEFDylibObject.h | |
| parent | ab37adbacf0f33845804c788b39680cd754752a8 (diff) | |
feat! breaking changes on kernel sources.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/KernelKit/IPEFDylibObject.h')
| -rw-r--r-- | dev/kernel/KernelKit/IPEFDylibObject.h | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/dev/kernel/KernelKit/IPEFDylibObject.h b/dev/kernel/KernelKit/IPEFDylibObject.h deleted file mode 100644 index 17ef02d5..00000000 --- a/dev/kernel/KernelKit/IPEFDylibObject.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ======================================================== - * - * Kernel - * Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. - * - * ======================================================== - */ - -#ifndef __KERNELKIT_PEF_SHARED_OBJECT_H__ -#define __KERNELKIT_PEF_SHARED_OBJECT_H__ - -#include <KernelKit/IDylibObject.h> -#include <KernelKit/PEF.h> -#include <KernelKit/PEFCodeMgr.h> -#include <KernelKit/ProcessScheduler.h> -#include <NeKit/Defines.h> - -namespace Kernel { -/** - * @brief Shared Library class - * Load library from this class - */ -class IPEFDylibObject final NE_DYLIB_OBJECT { - public: - explicit IPEFDylibObject() = default; - ~IPEFDylibObject() = default; - - public: - NE_COPY_DEFAULT(IPEFDylibObject) - - private: - DylibTraits* fMounted{nullptr}; - - public: - DylibTraits** GetAddressOf() { return &fMounted; } - - DylibTraits* Get() { return fMounted; } - - public: - void Mount(DylibTraits* to_mount) noexcept { - if (!to_mount || !to_mount->ImageObject) return; - - fMounted = to_mount; - - if (fLoader && to_mount) { - delete fLoader; - fLoader = nullptr; - } - - if (!fLoader) { - fLoader = new PEFLoader(fMounted->ImageObject); - } - } - - void Unmount() noexcept { - if (fMounted) fMounted = nullptr; - }; - - template <typename SymbolType> - SymbolType Load(const Char* symbol_name, const SizeT& len, const UInt32& kind) { - if (symbol_name == nullptr || *symbol_name == 0) return nullptr; - if (len > kPathLen || len < 1) return nullptr; - - auto ret = reinterpret_cast<SymbolType>(fLoader->FindSymbol(symbol_name, kind).Leak().Leak()); - - if (!ret) { - if (kind == kPefCode) return (VoidPtr) &__ne_pure_call; - - return nullptr; - } - - return ret; - } - - private: - PEFLoader* fLoader{nullptr}; -}; - -typedef IPEFDylibObject* IDylibRef; - -EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& header); -EXTERN_C Void rtl_fini_dylib_pef(USER_PROCESS& header, IDylibRef lib, Bool* successful); -} // namespace Kernel - -#endif /* ifndef __KERNELKIT_PEF_SHARED_OBJECT_H__ */ |
