diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-14 08:00:45 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-14 08:04:00 +0100 |
| commit | bf2892edf4185326c0d47d16106eaead05859f07 (patch) | |
| tree | 5d7e67998c380d2a48915432fe5f163627ceda99 /src/boot | |
| parent | 999f4e4dc191eb710abfc691043c5a0da9eadeea (diff) | |
[CHORE] Implemented atexit for BootZ.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/src/BootSupport.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/boot/src/BootSupport.cpp b/src/boot/src/BootSupport.cpp index 4ef887bb..232ac965 100644 --- a/src/boot/src/BootSupport.cpp +++ b/src/boot/src/BootSupport.cpp @@ -12,9 +12,26 @@ #include <KernelKit/PE.h> #ifdef __BOOTZ_STANDALONE__ + +#define kAtExitMaxDestructors (128U) + +typedef struct atexit_func_entry { + void(*destructor_func)(); +} atexit_func_entry_t; + +typedef long long uarch_t; + +atexit_func_entry_t __atexit_funcs[kAtExitMaxDestructors]; +uarch_t __atexit_func_count; + /// @note This function is a stub, not implemented by the bootloader as of right now. (AMLALE) EXTERN_C int atexit(void (*f)()) { - NE_UNUSED(f); + if (__atexit_func_count >= kAtExitMaxDestructors) return 1; + + __atexit_funcs[__atexit_func_count].destructor_func = f; + + __atexit_func_count++; + return 0; } |
