diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-28 19:13:46 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-28 19:13:46 +0200 |
| commit | 421db65331663304466577b7187780d9eba18077 (patch) | |
| tree | 3c7c4dc68537935b8cf98313e6a5bfe51786b7d2 /dev/ddk/ddk.h | |
| parent | b6e416c9986bb545956a642d626e6aafd54f3b76 (diff) | |
feat: Add common XPCOM controls directory, restructure project, and introduce API breaking changes
- Added a new directory for common XPCOM controls to organize reusable components.
- Restructured project layout for better modularity and maintainability.
- Introduced API breaking changes in the process, requiring adjustments for backward compatibility.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ddk/ddk.h')
| -rw-r--r-- | dev/ddk/ddk.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/dev/ddk/ddk.h b/dev/ddk/ddk.h new file mode 100644 index 00000000..89fe786d --- /dev/null +++ b/dev/ddk/ddk.h @@ -0,0 +1,105 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + FILE: KernelStd.h + PURPOSE: DDK Driver model base header. + +------------------------------------------- */ + +#pragma once + +#include <stdint.h> +#include <stddef.h> + +#if defined(__cplusplus) +#define DK_EXTERN extern "C" __declspec(dllexport) +#define nil nullptr +#undef NULL +#define NULL 0 +#define DK_FINAL final +#else +#define DK_EXTERN extern __declspec(dllexport) +#define nil ((void*)0) +#undef NULL +#define NULL ((void*)0) +#define DK_FINAL +#endif // defined(__cplusplus) + +#ifndef __DDK__ +#undef DK_EXTERN +#if defined(__cplusplus) +#define DK_EXTERN extern "C" __declspec(dllimport) +#else +#define DK_EXTERN __declspec(dllimport) +#endif +#endif + +#define ATTRIBUTE(X) __attribute__((X)) + +#ifndef __NEWOSKRNL__ +#error !!! including header in low exception/ring-3 mode !!! +#endif // __NEWOSKRNL__ + +struct DDK_STATUS_STRUCT; +struct DDK_OBJECT_MANIFEST; + +struct DDK_OBJECT_MANIFEST DK_FINAL +{ + char* p_name; + int32_t p_kind; + void* p_object; +}; + +/// \brief DDK status structure (__at_enable, __at_disable...) +struct DDK_STATUS_STRUCT DK_FINAL +{ + int32_t s_action_id; + int32_t s_issuer_id; + int32_t s_group_id; + void* s_object; +}; + +/// @brief Call Kernel (interrupt 0x33) +/// @param KernelRpcName +/// @param cnt number of elements in **dat** +/// @param dat data ptr +/// @param sz sz of whole data ptr. +/// @return result of call +DK_EXTERN void* KernelCall(const char* name, int32_t cnt, void* dat, size_t sz); + +/// @brief add system call. +/// @param slot system call slot +/// @param slotFn, syscall slot. +DK_EXTERN void KernelAddSyscall(const int32_t slot, void (*slotFn)(void* a0)); + +/// @brief allocate heap ptr. +/// @param sz size of ptr. +/// @return the pointer allocated or **nil**. +DK_EXTERN void* KernelAlloc(size_t sz); + +/// @brief free heap ptr. +/// @param pointer to free +DK_EXTERN void KernelFree(void*); + +/// @brief Get a Kernel property. +/// @param slot property id (always 0) +/// @param name the property's name. +/// @return property's object. +DK_EXTERN struct DDK_OBJECT_MANIFEST* KernelGetObject(const int slot, const char* name); + +/// @brief Set a Kernel property. +/// @param slot property id (always 0) +/// @param name the property's name. +/// @param ddk_pr pointer to a property's DDK_OBJECT_MANIFEST. +/// @return property's object. +DK_EXTERN void* KernelSetObject(const int32_t slot, const struct DDK_OBJECT_MANIFEST* ddk_pr); + +/// @brief The highest API version of the DDK. +DK_EXTERN int32_t c_api_version_highest; + +/// @brief The lowest API version of the DDK. +DK_EXTERN int32_t c_api_version_least; + +/// @brief c_api_version_least+c_api_version_highest combined version. +DK_EXTERN int32_t c_api_version; |
