summaryrefslogtreecommitdiffhomepage
path: root/src/libDDK/DriverKit/DriverKit.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-01 05:48:35 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-03-01 05:48:35 +0100
commit38cddd5dc02f886e5cb3a0e386f0f7a1e6c8da86 (patch)
tree69b8bfc0a3fc403abf165d501e18b57e63a2405e /src/libDDK/DriverKit/DriverKit.h
parent0871e5925e99e9a6f2d1eaf51ae82c7b4f740560 (diff)
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 <amlal@nekernel.org>
Diffstat (limited to 'src/libDDK/DriverKit/DriverKit.h')
-rw-r--r--src/libDDK/DriverKit/DriverKit.h79
1 files changed, 79 insertions, 0 deletions
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 <DriverKit/Defines.h>
+
+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