diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-24 06:57:42 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-24 06:58:12 +0200 |
| commit | 4b4fe020a328e991ffd15ae475ad7a5d38f097a5 (patch) | |
| tree | 990a0f03c13bb0878c00e8ec1d6f9c259ecb64a0 /dev/ddk/src/KernelAlloc.c | |
| parent | 107b2b9cad2b2502c3eebc0a77013edde2551257 (diff) | |
IMP: Working on Paging API...
FIX: Fixed the path of filesystem's ESP.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ddk/src/KernelAlloc.c')
| -rw-r--r-- | dev/ddk/src/KernelAlloc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dev/ddk/src/KernelAlloc.c b/dev/ddk/src/KernelAlloc.c new file mode 100644 index 00000000..af99f23b --- /dev/null +++ b/dev/ddk/src/KernelAlloc.c @@ -0,0 +1,36 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK allocator. + +------------------------------------------- */ + +#include <ddk/KernelStd.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); +} |
