summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/NewKit/KernelCheck.hxx
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 18:35:34 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 18:35:34 +0200
commitf3d931aa7cfaf96baef8383b59a8938779541ee7 (patch)
treefdb9fc51badb3dbd03e46ab0766a49d9522e13e2 /dev/Kernel/NewKit/KernelCheck.hxx
parent86640816e8b1d3595365f1fcc8a2a9e61fb40ff1 (diff)
[IMP] Moved source code into dev/ folder.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/NewKit/KernelCheck.hxx')
-rw-r--r--dev/Kernel/NewKit/KernelCheck.hxx61
1 files changed, 61 insertions, 0 deletions
diff --git a/dev/Kernel/NewKit/KernelCheck.hxx b/dev/Kernel/NewKit/KernelCheck.hxx
new file mode 100644
index 00000000..78d7506f
--- /dev/null
+++ b/dev/Kernel/NewKit/KernelCheck.hxx
@@ -0,0 +1,61 @@
+
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NewKit/Defines.hxx>
+
+namespace Kernel
+{
+ void ke_runtime_check(bool bExpression, const char* file, const char* line);
+}
+
+#define MUST_PASS_COMPILER(EXPR, MSG) static_assert(EXPR, MSG)
+#define __MUST_PASS(EXPR, FILE, LINE) \
+ Kernel::ke_runtime_check(EXPR, FILE, STRINGIFY(LINE))
+#define MUST_PASS(EXPR) __MUST_PASS(EXPR, __FILE__, __LINE__)
+#define assert(EXPR) MUST_PASS(EXPR, RUNTIME_CHECK_EXPRESSION)
+
+enum RUNTIME_CHECK
+{
+ RUNTIME_CHECK_FAILED = -1,
+ RUNTIME_CHECK_POINTER = 0,
+ RUNTIME_CHECK_EXPRESSION,
+ RUNTIME_CHECK_FILE,
+ RUNTIME_CHECK_IPC,
+ RUNTIME_CHECK_TLS,
+ RUNTIME_CHECK_HANDSHAKE,
+ RUNTIME_CHECK_ACPI,
+ RUNTIME_CHECK_INVALID_PRIVILEGE,
+ RUNTIME_CHECK_PROCESS,
+ RUNTIME_CHECK_BAD_BEHAVIOR,
+ RUNTIME_CHECK_BOOTSTRAP,
+ RUNTIME_CHECK_UNEXCPECTED,
+ RUNTIME_CHECK_COUNT,
+};
+
+namespace Kernel
+{
+ /// @brief Dumping factory class.
+ class RecoveryFactory final
+ {
+ public:
+ STATIC Void Recover() noexcept;
+ };
+
+ void ke_stop(const Int& id);
+} // namespace Kernel
+
+#ifdef TRY
+#undef TRY
+#endif
+
+#define TRY(FN) \
+ if (!FN()) \
+ { \
+ MUST_PASS(false); \
+ }