From 38cddd5dc02f886e5cb3a0e386f0f7a1e6c8da86 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 1 Mar 2026 05:48:35 +0100 Subject: feat: ddk!: Breaking changes, the DDK has been reworked in C++ instead. chore: public, kernel: fixes and important patches. Signed-off-by: Amlal El Mahrouss --- src/libDDK/DriverKit/Defines.h | 46 ++++++++++++++++ src/libDDK/DriverKit/Device.h | 47 +++++++++++++++++ src/libDDK/DriverKit/DriverKit.h | 79 ++++++++++++++++++++++++++++ src/libDDK/DriverKit/IO.h | 17 ++++++ src/libDDK/DriverKit/ObjectKit/Base.h | 48 +++++++++++++++++ src/libDDK/DriverKit/ObjectKit/Checksum.h | 39 ++++++++++++++ src/libDDK/DriverKit/ObjectKit/DriverKit.h | 11 ++++ src/libDDK/DriverKit/ObjectKit/checksum.h | 39 -------------- src/libDDK/DriverKit/ObjectKit/ddk.h | 11 ---- src/libDDK/DriverKit/ObjectKit/driver_base.h | 48 ----------------- src/libDDK/DriverKit/String.h | 16 ++++++ src/libDDK/DriverKit/ddk.h | 79 ---------------------------- src/libDDK/DriverKit/dev.h | 37 ------------- src/libDDK/DriverKit/io.h | 17 ------ src/libDDK/DriverKit/macros.h | 46 ---------------- src/libDDK/DriverKit/net.h | 14 ----- src/libDDK/DriverKit/str.h | 16 ------ 17 files changed, 303 insertions(+), 307 deletions(-) create mode 100644 src/libDDK/DriverKit/Defines.h create mode 100644 src/libDDK/DriverKit/Device.h create mode 100644 src/libDDK/DriverKit/DriverKit.h create mode 100644 src/libDDK/DriverKit/IO.h create mode 100644 src/libDDK/DriverKit/ObjectKit/Base.h create mode 100644 src/libDDK/DriverKit/ObjectKit/Checksum.h create mode 100644 src/libDDK/DriverKit/ObjectKit/DriverKit.h delete mode 100644 src/libDDK/DriverKit/ObjectKit/checksum.h delete mode 100644 src/libDDK/DriverKit/ObjectKit/ddk.h delete mode 100644 src/libDDK/DriverKit/ObjectKit/driver_base.h create mode 100644 src/libDDK/DriverKit/String.h delete mode 100644 src/libDDK/DriverKit/ddk.h delete mode 100644 src/libDDK/DriverKit/dev.h delete mode 100644 src/libDDK/DriverKit/io.h delete mode 100644 src/libDDK/DriverKit/macros.h delete mode 100644 src/libDDK/DriverKit/net.h delete mode 100644 src/libDDK/DriverKit/str.h (limited to 'src/libDDK/DriverKit') diff --git a/src/libDDK/DriverKit/Defines.h b/src/libDDK/DriverKit/Defines.h new file mode 100644 index 00000000..2817d809 --- /dev/null +++ b/src/libDDK/DriverKit/Defines.h @@ -0,0 +1,46 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_MACROS_H +#define DRIVERKIT_MACROS_H + +#include +#include + +#if defined(__cplusplus) +#define BOOL bool +#define YES true +#define NO false +#define DDK_EXTERN extern "C" +#define nil nullptr +#undef NULL +#define NULL 0 +#define DDK_FINAL final +#else +#define BOOL char +#define YES 1 +#define NO 0 +#define DDK_EXTERN extern +#define nil ((void*) 0) +#undef NULL +#define NULL ((void*) 0) +#define DDK_FINAL +#endif // defined(__cplusplus) + +#ifndef __DDK__ +#undef DDK_EXTERN +#if defined(__cplusplus) +#define DDK_EXTERN extern "C" +#else +#define DDK_EXTERN +#endif +#endif + +#define ATTRIBUTE(X) __attribute__((X)) + +#ifndef __NEOSKRNL__ +#error !!! Do not include header in EL0/Ring 3 mode !!! +#endif // __NEOSKRNL__ + +#endif diff --git a/src/libDDK/DriverKit/Device.h b/src/libDDK/DriverKit/Device.h new file mode 100644 index 00000000..6511b452 --- /dev/null +++ b/src/libDDK/DriverKit/Device.h @@ -0,0 +1,47 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_DEV_H +#define DRIVERKIT_DEV_H + +#include + +struct _DDK_DEVICE; + +#define DDK_DEVICE_NAME_LEN (255) + +#define DDK_TYPE_SOCKET (1) +#define DDK_TYPE_FILE (2) +#define DDK_TYPE_DEVICE (3) + +#define DDK_SUB_TYPE_TCP (1) +#define DDK_SUB_TYPE_UDP (2) +#define DDK_SUB_TYPE_BT (3) + +/// @brief Kernel Device driver. +typedef struct _DDK_DEVICE DDK_FINAL { + char d_name[DDK_DEVICE_NAME_LEN]; // the device name. Could be /./DEVICE_NAME/ + int d_type; + int d_subtype; + void* (*d_read)(void* arg, int len); // read from device. + void (*d_write)(void* arg, int len); + void (*d_wait)(void); // write to device. + struct _DDK_DEVICE* (*d_open)(const char* path); // open device. + void (*d_close)(struct _DDK_DEVICE* dev); // close device. + void (*d_seek)(struct _DDK_DEVICE* dev, size_t off); + size_t (*d_tell)(struct _DDK_DEVICE* dev); +} DDK_DEVICE, *DDK_DEVICE_PTR; + +#define kopen kopen_dev +#define kclose kclose_dev + +/// @brief Open a new device from path. +/// @param path the device's path. +DDK_EXTERN DDK_DEVICE_PTR kopen_dev(const char* path); + +/// @brief Close any device. +/// @param device valid device. +DDK_EXTERN BOOL kclose_dev(DDK_DEVICE_PTR device); + +#endif diff --git a/src/libDDK/DriverKit/DriverKit.h b/src/libDDK/DriverKit/DriverKit.h new file mode 100644 index 00000000..29bde0a6 --- /dev/null +++ b/src/libDDK/DriverKit/DriverKit.h @@ -0,0 +1,79 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_DDK_H +#define DRIVERKIT_DDK_H + +#include + +struct DDK_STATUS_STRUCT; +struct DDK_OBJECT_MANIFEST; + +typedef void* ptr_t; + +typedef ptr_t addr_t; + +typedef ptr_t vaddr_t; +typedef ptr_t paddr_t; + +/// \brief Object handle manifest. +struct DDK_OBJECT_MANIFEST DDK_FINAL { + char* p_name; + int32_t p_kind; + ptr_t p_object; +}; + +/// \brief DDK status ping structure. +struct DDK_STATUS_STRUCT DDK_FINAL { + int32_t s_action_id; + int32_t s_issuer_id; + int32_t s_group_id; + struct DDK_OBJECT_MANIFEST* s_object; +}; + +/// @brief Call Kernel procedure. +/// @param name the procedure name. +/// @param cnt number of elements in **dat** +/// @param dat data argument pointer. +/// @param sz sz of whole data argument pointer. +/// @return result of call +DDK_EXTERN void* ke_call_dispatch(const char* name, int32_t cnt, void* dat, size_t sz); + +/// @brief add a system call. +/// @param slot system call slot id. +/// @param slotFn, syscall slot. +DDK_EXTERN void ke_set_syscall(const int32_t slot, void (*slotFn)(void* a0)); + +/// @brief Allocates an heap ptr. +/// @param sz size of the allocated struct/type. +/// @return the pointer allocated or **nil**. +DDK_EXTERN void* kalloc(size_t sz); + +/// @brief Frees an heap ptr. +/// @param pointer kernel pointer to free. +DDK_EXTERN void kfree(void* the_ptr); + +/// @brief Gets a Kernel object. +/// @param slot object id (can be 0) +/// @param name the property's name. +/// @return DDK_OBJECT_MANIFEST. +DDK_EXTERN struct DDK_OBJECT_MANIFEST* ke_get_obj(const int slot, const char* name); + +/// @brief Set a Kernel object. +/// @param slot object id (can be 0) +/// @param name the property's name. +/// @param ddk_pr pointer to a object's DDK_OBJECT_MANIFEST. +/// @return returned object. +DDK_EXTERN void* ke_set_obj(const int32_t slot, const struct DDK_OBJECT_MANIFEST* ddk_pr); + +/// @brief The highest API version of the DDK. +DDK_EXTERN uint32_t kApiVersionHighest; + +/// @brief The lowest API version of the DDK. +DDK_EXTERN uint32_t kApiVersionLowest; + +/// @brief API version in BCD. +DDK_EXTERN uint32_t kApiVersion; + +#endif diff --git a/src/libDDK/DriverKit/IO.h b/src/libDDK/DriverKit/IO.h new file mode 100644 index 00000000..060f7f9b --- /dev/null +++ b/src/libDDK/DriverKit/IO.h @@ -0,0 +1,17 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_IO_H +#define DRIVERKIT_IO_H + +#include + +/// @brief print character into UART. +DDK_EXTERN void kputc(const char ch); + +/// @brief print string to UART. +/// @param message string to transmit to UART. +DDK_EXTERN void kprint(const char* message); + +#endif diff --git a/src/libDDK/DriverKit/ObjectKit/Base.h b/src/libDDK/DriverKit/ObjectKit/Base.h new file mode 100644 index 00000000..4d2f6072 --- /dev/null +++ b/src/libDDK/DriverKit/ObjectKit/Base.h @@ -0,0 +1,48 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_OBJECTKIT_DRIVER_BASE_H +#define DRIVERKIT_OBJECTKIT_DRIVER_BASE_H + +#include + +#define DDK_DRIVER_IMPL \ + final: \ + public \ + ::Kernel::DDK::IDriverBase + +/// @author Amlal El Mahrouss +/// @brief The DDK C++ API. + +namespace Kernel::DDK { + +inline constexpr auto kInvalidType = 0; + +/// @brief Driver interface type. +class IDriverBase { + public: + IDriverBase() = default; + virtual ~IDriverBase() = default; + + IDriverBase& operator=(const IDriverBase&) = default; + IDriverBase(const IDriverBase&) = default; + + using PtrType = void*; + + virtual constexpr bool IsCastable() { return false; } + virtual constexpr bool IsActive() { return false; } + virtual PtrType Leak() { return nullptr; } + virtual constexpr int32_t Type() { return kInvalidType; } +}; + +/// @brief This concept requires the Driver to be IDriverBase compliant. +/// @author @amlel-el-mahrouss +template +concept IsValidDriver = requires(Driver drv) { + { drv.IsActive() && drv.Type() > kInvalidType }; +}; + +} // namespace Kernel::DDK + +#endif diff --git a/src/libDDK/DriverKit/ObjectKit/Checksum.h b/src/libDDK/DriverKit/ObjectKit/Checksum.h new file mode 100644 index 00000000..e925f9ca --- /dev/null +++ b/src/libDDK/DriverKit/ObjectKit/Checksum.h @@ -0,0 +1,39 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_CHECKSUM_H +#define DRIVERKIT_CHECKSUM_H + +#include + +namespace Kernel::DDK { + +using IndexableBlob = char*; +using Indexable = char; + +/// @note This uses the FNV 64-bit variant. +/// @brief Performs a checksum computation for a memory region. +inline uintptr_t rtl_checksum(const IndexableBlob path) { + if (!path || *path == 0) return 0; + + const uintptr_t kFNVSeed = 0xcbf29ce484222325ULL; + const uintptr_t kFNVPrime = 0x100000001b3ULL; + + uintptr_t hash = kFNVSeed; + + IndexableBlob path_ = path; + + while (*path_) { + hash ^= (Indexable) (*path_++); + hash *= kFNVPrime; + } + + return hash; +} + +using Blob = void*; + +} // namespace Kernel::DDK + +#endif diff --git a/src/libDDK/DriverKit/ObjectKit/DriverKit.h b/src/libDDK/DriverKit/ObjectKit/DriverKit.h new file mode 100644 index 00000000..490e7d03 --- /dev/null +++ b/src/libDDK/DriverKit/ObjectKit/DriverKit.h @@ -0,0 +1,11 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_DDK_H +#define DRIVERKIT_DDK_H + +#include +#include + +#endif diff --git a/src/libDDK/DriverKit/ObjectKit/checksum.h b/src/libDDK/DriverKit/ObjectKit/checksum.h deleted file mode 100644 index 92c63603..00000000 --- a/src/libDDK/DriverKit/ObjectKit/checksum.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_CHECKSUM_H -#define DRIVERKIT_CHECKSUM_H - -#include - -namespace Kernel::DDK { - -using IndexableBlob = char*; -using Indexable = char; - -/// @note This uses the FNV 64-bit variant. -/// @brief Performs a checksum computation for a memory region. -inline uintptr_t rtl_checksum(const IndexableBlob path) { - if (!path || *path == 0) return 0; - - const uintptr_t kFNVSeed = 0xcbf29ce484222325ULL; - const uintptr_t kFNVPrime = 0x100000001b3ULL; - - uintptr_t hash = kFNVSeed; - - IndexableBlob path_ = path; - - while (*path_) { - hash ^= (Indexable) (*path_++); - hash *= kFNVPrime; - } - - return hash; -} - -using Blob = void*; - -} // namespace Kernel::DDK - -#endif diff --git a/src/libDDK/DriverKit/ObjectKit/ddk.h b/src/libDDK/DriverKit/ObjectKit/ddk.h deleted file mode 100644 index 2d6dec75..00000000 --- a/src/libDDK/DriverKit/ObjectKit/ddk.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_DDK_H -#define DRIVERKIT_DDK_H - -#include -#include - -#endif diff --git a/src/libDDK/DriverKit/ObjectKit/driver_base.h b/src/libDDK/DriverKit/ObjectKit/driver_base.h deleted file mode 100644 index f5811fb2..00000000 --- a/src/libDDK/DriverKit/ObjectKit/driver_base.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_OBJECTKIT_DRIVER_BASE_H -#define DRIVERKIT_OBJECTKIT_DRIVER_BASE_H - -#include - -#define DDK_DRIVER_IMPL \ - final: \ - public \ - ::Kernel::DDK::IDriverBase - -/// @author Amlal El Mahrouss -/// @brief The DDK C++ API. - -namespace Kernel::DDK { - -inline constexpr auto kInvalidType = 0; - -/// @brief Driver interface type. -class IDriverBase { - public: - IDriverBase() = default; - virtual ~IDriverBase() = default; - - IDriverBase& operator=(const IDriverBase&) = default; - IDriverBase(const IDriverBase&) = default; - - using PtrType = void*; - - virtual constexpr bool IsCastable() { return false; } - virtual constexpr bool IsActive() { return false; } - virtual PtrType Leak() { return nullptr; } - virtual constexpr int32_t Type() { return kInvalidType; } -}; - -/// @brief This concept requires the Driver to be IDriverBase compliant. -/// @author @amlel-el-mahrouss -template -concept IsValidDriver = requires(Driver drv) { - { drv.IsActive() && drv.Type() > kInvalidType }; -}; - -} // namespace Kernel::DDK - -#endif diff --git a/src/libDDK/DriverKit/String.h b/src/libDDK/DriverKit/String.h new file mode 100644 index 00000000..5f56f95b --- /dev/null +++ b/src/libDDK/DriverKit/String.h @@ -0,0 +1,16 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#ifndef DRIVERKIT_STR_H +#define DRIVERKIT_STR_H + +#include + +/// @brief DDK equivalent of POSIX's string.h +/// @file str.h + +DDK_EXTERN size_t kstrlen(const char* in); +DDK_EXTERN int kstrncpy(char* dst, const char* src, size_t len); + +#endif diff --git a/src/libDDK/DriverKit/ddk.h b/src/libDDK/DriverKit/ddk.h deleted file mode 100644 index 2ff2db9e..00000000 --- a/src/libDDK/DriverKit/ddk.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_DDK_H -#define DRIVERKIT_DDK_H - -#include - -struct DDK_STATUS_STRUCT; -struct DDK_OBJECT_MANIFEST; - -typedef void* ptr_t; - -typedef ptr_t addr_t; - -typedef ptr_t vaddr_t; -typedef ptr_t paddr_t; - -/// \brief Object handle manifest. -struct DDK_OBJECT_MANIFEST DDK_FINAL { - char* p_name; - int32_t p_kind; - ptr_t p_object; -}; - -/// \brief DDK status ping structure. -struct DDK_STATUS_STRUCT DDK_FINAL { - int32_t s_action_id; - int32_t s_issuer_id; - int32_t s_group_id; - struct DDK_OBJECT_MANIFEST* s_object; -}; - -/// @brief Call Kernel procedure. -/// @param name the procedure name. -/// @param cnt number of elements in **dat** -/// @param dat data argument pointer. -/// @param sz sz of whole data argument pointer. -/// @return result of call -DDK_EXTERN void* ke_call_dispatch(const char* name, int32_t cnt, void* dat, size_t sz); - -/// @brief add a system call. -/// @param slot system call slot id. -/// @param slotFn, syscall slot. -DDK_EXTERN void ke_set_syscall(const int32_t slot, void (*slotFn)(void* a0)); - -/// @brief Allocates an heap ptr. -/// @param sz size of the allocated struct/type. -/// @return the pointer allocated or **nil**. -DDK_EXTERN void* kalloc(size_t sz); - -/// @brief Frees an heap ptr. -/// @param pointer kernel pointer to free. -DDK_EXTERN void kfree(void* the_ptr); - -/// @brief Gets a Kernel object. -/// @param slot object id (can be 0) -/// @param name the property's name. -/// @return DDK_OBJECT_MANIFEST. -DDK_EXTERN struct DDK_OBJECT_MANIFEST* ke_get_obj(const int slot, const char* name); - -/// @brief Set a Kernel object. -/// @param slot object id (can be 0) -/// @param name the property's name. -/// @param ddk_pr pointer to a object's DDK_OBJECT_MANIFEST. -/// @return returned object. -DDK_EXTERN void* ke_set_obj(const int32_t slot, const struct DDK_OBJECT_MANIFEST* ddk_pr); - -/// @brief The highest API version of the DDK. -DDK_EXTERN uint32_t kApiVersionHighest; - -/// @brief The lowest API version of the DDK. -DDK_EXTERN uint32_t kApiVersionLowest; - -/// @brief API version in BCD. -DDK_EXTERN uint32_t kApiVersion; - -#endif diff --git a/src/libDDK/DriverKit/dev.h b/src/libDDK/DriverKit/dev.h deleted file mode 100644 index c3c12ca4..00000000 --- a/src/libDDK/DriverKit/dev.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_DEV_H -#define DRIVERKIT_DEV_H - -#include - -struct _DDK_DEVICE; - -#define DDK_DEVICE_NAME_LEN (255) - -/// @brief Kernel Device driver. -typedef struct _DDK_DEVICE DDK_FINAL { - char d_name[DDK_DEVICE_NAME_LEN]; // the device name. Could be /./DEVICE_NAME/ - void* (*d_read)(void* arg, int len); // read from device. - void (*d_write)(void* arg, int len); - void (*d_wait)(void); // write to device. - struct _DDK_DEVICE* (*d_open)(const char* path); // open device. - void (*d_close)(struct _DDK_DEVICE* dev); // close device. - void (*d_seek)(struct _DDK_DEVICE* dev, size_t off); - size_t (*d_tell)(struct _DDK_DEVICE* dev); -} DDK_DEVICE, *DDK_DEVICE_PTR; - -#define kopen kopen_dev -#define kclose kclose_dev - -/// @brief Open a new device from path. -/// @param path the device's path. -DDK_EXTERN DDK_DEVICE_PTR kopen_dev(const char* path); - -/// @brief Close any device. -/// @param device valid device. -DDK_EXTERN BOOL kclose_dev(DDK_DEVICE_PTR device); - -#endif diff --git a/src/libDDK/DriverKit/io.h b/src/libDDK/DriverKit/io.h deleted file mode 100644 index 28cf3038..00000000 --- a/src/libDDK/DriverKit/io.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_IO_H -#define DRIVERKIT_IO_H - -#include - -/// @brief print character into UART. -DDK_EXTERN void kputc(const char ch); - -/// @brief print string to UART. -/// @param message string to transmit to UART. -DDK_EXTERN void kprint(const char* message); - -#endif diff --git a/src/libDDK/DriverKit/macros.h b/src/libDDK/DriverKit/macros.h deleted file mode 100644 index 12f9d634..00000000 --- a/src/libDDK/DriverKit/macros.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_MACROS_H -#define DRIVERKIT_MACROS_H - -#include -#include - -#if defined(__cplusplus) -#define BOOL bool -#define YES true -#define NO false -#define DDK_EXTERN extern "C" -#define nil nullptr -#undef NULL -#define NULL 0 -#define DDK_FINAL final -#else -#define BOOL char -#define YES 1 -#define NO 0 -#define DDK_EXTERN extern -#define nil ((void*) 0) -#undef NULL -#define NULL ((void*) 0) -#define DDK_FINAL -#endif // defined(__cplusplus) - -#ifndef __DDK__ -#undef DDK_EXTERN -#if defined(__cplusplus) -#define DDK_EXTERN extern "C" -#else -#define DDK_EXTERN -#endif -#endif - -#define ATTRIBUTE(X) __attribute__((X)) - -#ifndef __NEOSKRNL__ -#error !!! Do not include header in EL0/Ring 3 mode !!! -#endif // __NEOSKRNL__ - -#endif diff --git a/src/libDDK/DriverKit/net.h b/src/libDDK/DriverKit/net.h deleted file mode 100644 index ecffb983..00000000 --- a/src/libDDK/DriverKit/net.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_NET_H -#define DRIVERKIT_NET_H - -#include - -struct DDK_NET_MANIFEST; - -/// @brief IFS hooks to plug into the FileMgr. - -#endif diff --git a/src/libDDK/DriverKit/str.h b/src/libDDK/DriverKit/str.h deleted file mode 100644 index 9c1386ab..00000000 --- a/src/libDDK/DriverKit/str.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) -// Licensed under the Apache License, Version 2.0 (see LICENSE file) -// Official repository: https://github.com/nekernel-org/nekernel - -#ifndef DRIVERKIT_STR_H -#define DRIVERKIT_STR_H - -#include - -/// @brief DDK equivalent of POSIX's string.h -/// @file str.h - -DDK_EXTERN size_t kstrlen(const char* in); -DDK_EXTERN int kstrncpy(char* dst, const char* src, size_t len); - -#endif -- cgit v1.2.3