My Kernel v0.1.0
kmalloc.h
Go to the documentation of this file.
1
50#pragma once
51
52#include <kernel/types.h>
53
58typedef enum kmalloc_flags {
59 KMALLOC_KERNEL = 0, /* Default allocation flags. */
61
72void *kmalloc(size_t size, int flags);
73
83void *kcalloc(size_t nmemb, size_t size, int flags);
84
86void kfree(void *ptr);
87
105void *krealloc(void *ptr, size_t size, int flags);
106
114void *krealloc_array(void *ptr, size_t nmemb, size_t size, int flags);
115
125void *kmalloc_dma(size_t size);
126
128void kfree_dma(void *dma_ptr);
129
void kfree(void *ptr)
Free a pointer allocated through Kernel dynamic allocator.
Definition: kmalloc.c:192
void * kmalloc(size_t size, int flags)
Allocate size bytes and return a pointer to the allocated memory.
Definition: kmalloc.c:158
void * krealloc_array(void *ptr, size_t nmemb, size_t size, int flags)
Change the size of the given memory block.
Definition: kmalloc.c:230
void * kcalloc(size_t nmemb, size_t size, int flags)
Allocate nmemb members of size bytes and initialize its content to 0.
Definition: kmalloc.c:180
void * kmalloc_dma(size_t size)
Allocate an addressable memory buffer suitable for DMA operations.
Definition: kmalloc.c:238
kmalloc_flags
Feature flags passed to the kmalloc function family.
Definition: kmalloc.h:58
void * krealloc(void *ptr, size_t size, int flags)
Change the size of the given memory block.
Definition: kmalloc.c:203
void kfree_dma(void *dma_ptr)
Free a buffer allocated through kmalloc_dma.
Definition: kmalloc.c:256