summaryrefslogtreecommitdiffhomepage
path: root/dev/zka/KernelKit
diff options
context:
space:
mode:
Diffstat (limited to 'dev/zka/KernelKit')
-rw-r--r--dev/zka/KernelKit/Heap.hxx23
-rw-r--r--dev/zka/KernelKit/ThreadLocalStorage.inl2
-rw-r--r--dev/zka/KernelKit/User.hxx6
-rw-r--r--dev/zka/KernelKit/UserProcessScheduler.hxx6
4 files changed, 22 insertions, 15 deletions
diff --git a/dev/zka/KernelKit/Heap.hxx b/dev/zka/KernelKit/Heap.hxx
index 554ba954..cfa3fc94 100644
--- a/dev/zka/KernelKit/Heap.hxx
+++ b/dev/zka/KernelKit/Heap.hxx
@@ -4,37 +4,38 @@
------------------------------------------- */
-#ifndef _INC_KERNEL_HEAP_HXX_
-#define _INC_KERNEL_HEAP_HXX_
+#ifndef INC_KERNEL_HEAP_HXX
+#define INC_KERNEL_HEAP_HXX
// last-rev 30/01/24
-// file: KernelHeap.hxx
+// file: Heap.hxx
// description: heap allocation for the Kernel.
#include <NewKit/Defines.hxx>
+#include <NewKit/Stop.hxx>
namespace Kernel
{
/// @brief Declare pointer as free.
/// @param heap_ptr the pointer.
- /// @return
+ /// @return a status code regarding the deallocation.
Int32 mm_delete_heap(VoidPtr heap_ptr);
/// @brief Declare a new size for heap_ptr.
/// @param heap_ptr the pointer.
- /// @return
+ /// @return unsupported always returns nullptr.
VoidPtr mm_realloc_heap(VoidPtr heap_ptr, SizeT new_sz);
/// @brief Check if pointer is a valid Kernel pointer.
/// @param heap_ptr the pointer
- /// @return if it exists.
+ /// @return if it exists it returns true.
Boolean mm_is_valid_heap(VoidPtr heap_ptr);
/// @brief Allocate chunk of memory.
/// @param sz Size of pointer
/// @param wr Read Write bit.
/// @param user User enable bit.
- /// @return The newly allocated pointer.
+ /// @return The newly allocated pointer, or nullptr.
VoidPtr mm_new_heap(const SizeT sz, const Bool wr, const Bool user);
/// @brief Protect the heap with a CRC value.
@@ -52,6 +53,12 @@ namespace Kernel
inline T* mm_new_class(Args&&... args)
{
T* cls = new T(move(args)...);
+
+ if (cls == nullptr)
+ {
+ ke_stop(RUNTIME_CHECK_POINTER);
+ }
+
return cls;
}
@@ -64,4 +71,4 @@ namespace Kernel
}
} // namespace Kernel
-#endif // !_INC_KERNEL_HEAP_HXX_
+#endif // !INC_KERNEL_HEAP_HXX
diff --git a/dev/zka/KernelKit/ThreadLocalStorage.inl b/dev/zka/KernelKit/ThreadLocalStorage.inl
index a800f329..2f0fe553 100644
--- a/dev/zka/KernelKit/ThreadLocalStorage.inl
+++ b/dev/zka/KernelKit/ThreadLocalStorage.inl
@@ -7,7 +7,7 @@
//! @file ThreadLocalStorage.inl
//! @brief Allocate resources from the process's heap storage.
-#ifndef _INC_PROCESS_SCHEDULER_HXX_
+#ifndef INC_PROCESS_SCHEDULER_HXX
#include <KernelKit/UserProcessScheduler.hxx>
#endif
diff --git a/dev/zka/KernelKit/User.hxx b/dev/zka/KernelKit/User.hxx
index 344ca5e5..d082bf93 100644
--- a/dev/zka/KernelKit/User.hxx
+++ b/dev/zka/KernelKit/User.hxx
@@ -4,8 +4,8 @@
------------------------------------------- */
-#ifndef _INC_USER_HXX_
-#define _INC_USER_HXX_
+#ifndef INC_USER_HXX
+#define INC_USER_HXX
#include <CompilerKit/CompilerKit.hxx>
#include <KernelKit/LPC.hxx>
@@ -72,4 +72,4 @@ namespace Kernel
};
} // namespace Kernel
-#endif /* ifndef _INC_USER_HXX_ */
+#endif /* ifndef INC_USER_HXX */
diff --git a/dev/zka/KernelKit/UserProcessScheduler.hxx b/dev/zka/KernelKit/UserProcessScheduler.hxx
index d383251c..bc246683 100644
--- a/dev/zka/KernelKit/UserProcessScheduler.hxx
+++ b/dev/zka/KernelKit/UserProcessScheduler.hxx
@@ -4,8 +4,8 @@
------------------------------------------- */
-#ifndef _INC_PROCESS_SCHEDULER_HXX_
-#define _INC_PROCESS_SCHEDULER_HXX_
+#ifndef INC_PROCESS_SCHEDULER_HXX
+#define INC_PROCESS_SCHEDULER_HXX
#include <ArchKit/ArchKit.hxx>
#include <KernelKit/LockDelegate.hxx>
@@ -319,4 +319,4 @@ namespace Kernel
////////////////////////////////////////////////////
-#endif /* ifndef _INC_PROCESS_SCHEDULER_HXX_ */
+#endif /* ifndef INC_PROCESS_SCHEDULER_HXX */