summaryrefslogtreecommitdiffhomepage
path: root/src/libDDK/DriverKit/c++
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-26 00:11:43 -0500
committerGitHub <noreply@github.com>2025-11-26 00:11:43 -0500
commit286c9c16a42399716b4ecaa7cab902e5434fa0a6 (patch)
tree5e82555fd3c5bf1e0484e9c6149c192b19708023 /src/libDDK/DriverKit/c++
parent1dc16c306587b4d6410adfcd4dca8f7ba13df78f (diff)
parent2187ed0f67e21c6425b8770ff52ca02269a21a9d (diff)
Merge pull request #83 from nekernel-org/dev
Hotpatches.
Diffstat (limited to 'src/libDDK/DriverKit/c++')
-rw-r--r--src/libDDK/DriverKit/c++/checksum.h10
-rw-r--r--src/libDDK/DriverKit/c++/ddk.h13
-rw-r--r--src/libDDK/DriverKit/c++/driver_base.h48
3 files changed, 71 insertions, 0 deletions
diff --git a/src/libDDK/DriverKit/c++/checksum.h b/src/libDDK/DriverKit/c++/checksum.h
new file mode 100644
index 00000000..0aa206be
--- /dev/null
+++ b/src/libDDK/DriverKit/c++/checksum.h
@@ -0,0 +1,10 @@
+/* ========================================
+
+ Copyright Amlal El Mahrouss 2025, licensed under the Apache 2.0 license.
+
+ FILE: checksum.h
+ PURPOSE: Object DDK checksums.
+
+ ======================================== */
+
+#pragma once \ No newline at end of file
diff --git a/src/libDDK/DriverKit/c++/ddk.h b/src/libDDK/DriverKit/c++/ddk.h
new file mode 100644
index 00000000..2c83f935
--- /dev/null
+++ b/src/libDDK/DriverKit/c++/ddk.h
@@ -0,0 +1,13 @@
+/* ========================================
+
+ Copyright Amlal El Mahrouss 2025, licensed under the Apache 2.0 license.
+
+ FILE: ddk.h
+ PURPOSE: Object DDK header.
+
+ ======================================== */
+
+#pragma once
+
+#include <DriverKit/c++/driver_base.h>
+#include <DriverKit/c++/checksum.h>
diff --git a/src/libDDK/DriverKit/c++/driver_base.h b/src/libDDK/DriverKit/c++/driver_base.h
new file mode 100644
index 00000000..89cc04d8
--- /dev/null
+++ b/src/libDDK/DriverKit/c++/driver_base.h
@@ -0,0 +1,48 @@
+/* ========================================
+
+ Copyright Amlal El Mahrouss 2025, licensed under the Apache 2.0 license.
+
+ FILE: driver_base.h
+ PURPOSE: IDriverBase and friends.
+
+ ======================================== */
+
+#pragma once
+
+#include <CompilerKit/CompilerKit.h>
+#include <libDDK/DriverKit/macros.h>
+
+#define DKI_DRIVER_IMPL \
+ final: \
+ public \
+ ::Kernel::DDK::IDriverBase
+
+/// @author Amlal El Mahrouss
+
+namespace Kernel::DDK {
+class IDriverBase {
+ public:
+ explicit IDriverBase() = default;
+ virtual ~IDriverBase() = default;
+
+ NE_COPY_DEFAULT(IDriverBase);
+
+ using PtrType = VoidPtr;
+
+ virtual BOOL IsCastable() { return NO; }
+ virtual constexpr BOOL IsActive() { return NO; }
+ virtual PtrType Leak() { return nullptr; }
+ virtual constexpr Int32 Type() { return 0; }
+};
+
+/// @brief This concept requires the Driver to be IDriverBase compliant.
+template <typename T>
+concept IsValidDriver = requires(T a) {
+ { a.IsActive() && a.Type() > 0 };
+};
+
+/// @brief Consteval helper to detect whether a template is truly based on IDriverBase.
+/// @note This helper is consteval only.
+template<IsValidDriver T>
+inline consteval void ce_ddk_is_valid(T) {}
+} // namespace Kernel::DDK