summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/KernelCheck.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Private/NewKit/KernelCheck.hpp')
-rw-r--r--Private/NewKit/KernelCheck.hpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/Private/NewKit/KernelCheck.hpp b/Private/NewKit/KernelCheck.hpp
new file mode 100644
index 00000000..9f37eb8e
--- /dev/null
+++ b/Private/NewKit/KernelCheck.hpp
@@ -0,0 +1,60 @@
+
+/*
+ * ========================================================
+ *
+ * HCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+#include <NewKit/Defines.hpp>
+
+namespace HCore {
+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) \
+ HCore::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_LD,
+ RUNTIME_CHECK_HANDSHAKE,
+ RUNTIME_CHECK_ACPI,
+ RUNTIME_CHECK_INVALID_PRIVILEGE,
+ RUNTIME_CHECK_PROCESS,
+ RUNTIME_CHECK_BAD_BEHAVIOR,
+ RUNTIME_CHECK_COUNT,
+ RUNTIME_CHECK_BOOTSTRAP,
+};
+
+namespace HCore {
+class DumpManager final {
+ public:
+ static void Dump(void) {
+ // TODO:
+ }
+};
+
+void ke_stop(const Int &id);
+} // namespace HCore
+
+#ifdef TRY
+#undef TRY
+#endif
+
+#define TRY(FN) \
+ if (!FN()) { \
+ MUST_PASS(false); \
+ }