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/src/ddk_alloc.c | |
| 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/src/ddk_alloc.c')
| -rw-r--r-- | dev/ddk/src/ddk_alloc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dev/ddk/src/ddk_alloc.c b/dev/ddk/src/ddk_alloc.c new file mode 100644 index 00000000..3c379bf7 --- /dev/null +++ b/dev/ddk/src/ddk_alloc.c @@ -0,0 +1,36 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK allocator. + +------------------------------------------- */ + +#include <ddk/ddk.h> + +/** + \brief Allocates a new heap on the Kernel's side. + \param sz the size of the heap block. + \return the newly allocated pointer. +*/ +DK_EXTERN void* KernelAlloc(size_t sz) +{ + if (!sz) + ++sz; + + void* ptr = KernelCall("MmNewKeHeap", 1, &sz, sizeof(size_t)); + + return ptr; +} + +/** + \brief Frees a pointer from the heap. + \param ptr the pointer to free. +*/ +DK_EXTERN void KernelFree(void* ptr) +{ + if (!ptr) + return; + + KernelCall("MmDeleteKeHeap", 1, ptr, 0); +} |
