fix bugs found in brk & add simple security checks on lx_free
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / kalloc.h
1 #ifndef __LUNAIX_KALLOC_H
2 #define __LUNAIX_KALLOC_H
3
4 #include <stddef.h>
5
6 int
7 kalloc_init();
8
9 /**
10  * @brief Allocate an accessible memory region in kernel heap. 
11  * 
12  * @remarks 
13  *  This is NOT the same as kmalloc in Linux! 
14  *  LunaixOS does NOT guarantee the continuity in physical pages.
15  * 
16  * @param size 
17  * @return void* 
18  */
19 void*
20 kmalloc(size_t size);
21
22 /**
23  * @brief calloc for kernel heap. A wrapper for kmalloc
24  * @param size 
25  * @return void*
26  */
27 void*
28 kcalloc(size_t size);
29
30 /**
31  * @brief Free the memory region allocated by kmalloc
32  * 
33  * @param size 
34  * @return void* 
35  */
36 void
37 kfree(void* ptr);
38
39 #endif /* __LUNAIX_KALLOC_H */