diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-30 08:49:23 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-30 08:49:23 +0200 |
| commit | bf642edd6c77d405637f0695452460640b8e540d (patch) | |
| tree | e8e78f658e5eac62790a0fb8129a491183db92d5 /DDKit/KernelStd.h | |
| parent | 60902ec5fc462128d264f63f279c7fc362a72e1d (diff) | |
[Refactor] SCIKit and DDKit.
[IMP} Prevent DDK from being included when we aren't in kernel mode.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'DDKit/KernelStd.h')
| -rw-r--r-- | DDKit/KernelStd.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/DDKit/KernelStd.h b/DDKit/KernelStd.h new file mode 100644 index 00000000..bdd8ce3d --- /dev/null +++ b/DDKit/KernelStd.h @@ -0,0 +1,67 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies + + Purpose: DDK Definitions. + +------------------------------------------- */ + +#pragma once + +#include <stdint.h> +#include <stddef.h> + +#if defined(__cplusplus) +#define DK_EXTERN extern "C" +#define nil nullptr +#define DK_FINAL final +#else +#define DK_EXTERN extern +#define nil ((void*)0) +#define DK_FINAL +#endif // defined(__cplusplus) + +#ifndef __KERNEL__ +#error !!! including header in kernel mode !!! +#endif // __KERNEL__ + +struct DDK_STATUS_STRUCT; + +/// \brief DDK status structure (__at_enable, __at_disable...) +struct DDK_STATUS_STRUCT DK_FINAL +{ + int32_t action_id; + int32_t issuer_id; + int32_t group_id; +}; + +/// @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* kernelRpcName, 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 int 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 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;
\ No newline at end of file |
