diff options
Diffstat (limited to 'src/libDDK/DriverKit/c++')
| -rw-r--r-- | src/libDDK/DriverKit/c++/checksum.h | 10 | ||||
| -rw-r--r-- | src/libDDK/DriverKit/c++/ddk.h | 13 | ||||
| -rw-r--r-- | src/libDDK/DriverKit/c++/driver_base.h | 48 |
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 |
