From 2187ed0f67e21c6425b8770ff52ca02269a21a9d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 26 Nov 2025 00:08:26 -0500 Subject: kernel: a long set of kernel patches. Signed-off-by: Amlal El Mahrouss --- src/libDDK/DriverKit/c++/checksum.h | 10 +++++++ src/libDDK/DriverKit/c++/contract.h | 48 ---------------------------------- src/libDDK/DriverKit/c++/ddk.h | 13 +++++++++ src/libDDK/DriverKit/c++/driver_base.h | 48 ++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 48 deletions(-) create mode 100644 src/libDDK/DriverKit/c++/checksum.h delete mode 100644 src/libDDK/DriverKit/c++/contract.h create mode 100644 src/libDDK/DriverKit/c++/ddk.h create mode 100644 src/libDDK/DriverKit/c++/driver_base.h (limited to 'src/libDDK/DriverKit/c++') 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++/contract.h b/src/libDDK/DriverKit/c++/contract.h deleted file mode 100644 index e341f1a0..00000000 --- a/src/libDDK/DriverKit/c++/contract.h +++ /dev/null @@ -1,48 +0,0 @@ -/* ======================================== - - Copyright Amlal El Mahrouss 2025, licensed under the Apache 2.0 license. - - FILE: ddk.h - PURPOSE: Driver Kernel Interface Model base header. - - ======================================== */ - -#pragma once - -#include -#include - -#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 -concept IsValidDriver = requires(T a) { - { a.IsActive() && a.Type() > 0 }; -}; - -/// @note This helper is consteval only. -template -inline consteval void ce_ddk_is_valid(T) {} - -} // namespace Kernel::DDK 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 +#include 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 +#include + +#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 +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 +inline consteval void ce_ddk_is_valid(T) {} +} // namespace Kernel::DDK -- cgit v1.2.3