From 421db65331663304466577b7187780d9eba18077 Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 28 Sep 2024 19:13:46 +0200 Subject: 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 --- dev/ddk/src/ddk_alloc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 dev/ddk/src/ddk_alloc.c (limited to 'dev/ddk/src/ddk_alloc.c') 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 + +/** + \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); +} -- cgit v1.2.3