diff options
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; } |
