blob: 5ca4c8cd2e00202b88ee6fd5eefd075b02acc5af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/**
* @file
*
* In-Kernel Block Memory Allocation
* =================================
*
* The kernel reserves some memory for internal operation, since malloc
* is not available.
*
* Threads
* -------
* kballoc() and kbfree() are protected with spinlocks so you can
* call them simultanously, even from multiple cpus!
*
* Todo
* ----
* zeroalloc, alloc bytes, realloc
*
*/
#include <stdint.h>
/** Allocate size*4096 bytes and returns a 32-bit address
* and 0 if fails.
* */
uint32_t kballoc (uint32_t size);
/** Free memory allocated before by supplying the address returned by kballoc */
void kbfree (uint32_t addr);
/** Get current status for sysfs */
void kmalloc_sysfs(void (*f)(char *fmt, ...));
|